Vendor/phpspreadsheet/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Content.php
private function writeCells(XMLWriter $objWriter, Row $row)
    {
        $numberColsRepeated = self::NUMBER_COLS_REPEATED_MAX;
        $prevColumn = -1;
        $cells = $row->getCellIterator();
        while ($cells->valid()) {
            /** @var \PhpOffice\PhpSpreadsheet\Cell\Cell $cell */
            $cell = $cells->current();
            $column = Coordinate::columnIndexFromString($cell->getColumn()) - 1;

            $this->writeCellSpan($objWriter, $column, $prevColumn);
            $objWriter->startElement('table:table-cell');
            $this->writeCellMerge($objWriter, $cell);

            // Style XF
            $style = $cell->getXfIndex();
            if ($style !== null) {
                $objWriter->writeAttribute('table:style-name', self::CELL_STYLE_PREFIX . $style);
            }

            switch ($cell->getDataType()) {
                case DataType::TYPE_BOOL:
                    $objWriter->writeAttribute('office:value-type', 'boolean');
                    $objWriter->writeAttribute('office:value', $cell->getValue());
                    $objWriter->writeElement('text:p', $cell->getValue());

                    break;
                case DataType::TYPE_ERROR:
                    throw new Exception('Writing of error not implemented yet.');

                    break;
                case DataType::TYPE_FORMULA:
                    $formulaValue = $cell->getValue();
                    if ($this->getParentWriter()->getPreCalculateFormulas()) {
                        try {
                            $formulaValue = $cell->getCalculatedValue();
                        } catch (Exception $e) {
                            // don't do anything
                        }
                    }
                    $objWriter->writeAttribute('table:formula', 'of:' . $cell->getValue());
                    if (is_numeric($formulaValue)) {
                        $objWriter->writeAttribute('office:value-type', 'float');
                    } else {
                        $objWriter->writeAttribute('office:value-type', 'string');
                    }
                    $objWriter->writeAttribute('office:value', $formulaValue);
                    $objWriter->writeElement('text:p', $formulaValue);

                    break;
                case DataType::TYPE_INLINE:
                    throw new Exception('Writing of inline not implemented yet.');

                    break;
                case DataType::TYPE_NUMERIC:
                    $objWriter->writeAttribute('office:value-type', 'float');
                    $objWriter->writeAttribute('office:value', $cell->getValue());
                    $objWriter->writeElement('text:p', $cell->getValue());

                    break;
                case DataType::TYPE_STRING:
                    $objWriter->writeAttribute('office:value-type', 'string');
                    $objWriter->writeElement('text:p', $cell->getValue());

                    break;
            }
            Comment::write($objWriter, $cell);
            $objWriter->endElement();
            $prevColumn = $column;
            $cells->next();
        }
        $numberColsRepeated = $numberColsRepeated - $prevColumn - 1;
        if ($numberColsRepeated > 0) {
            if ($numberColsRepeated > 1) {
                $objWriter->startElement('table:table-cell');
                $objWriter->writeAttribute('table:number-columns-repeated', $numberColsRepeated);
                $objWriter->endElement();
            } else {
                $objWriter->writeElement('table:table-cell');
            }
        }
    }
private function writeCells(XMLWriter $objWriter, Row $row)
    {
        $numberColsRepeated = self::NUMBER_COLS_REPEATED_MAX;
        $prevColumn = -1;
        $cells = $row->getCellIterator();
        while ($cells->valid()) {
            /** @var \PhpOffice\PhpSpreadsheet\Cell\Cell $cell */
            $cell = $cells->current();
            $column = Coordinate::columnIndexFromString($cell->getColumn()) - 1;

            $this->writeCellSpan($objWriter, $column, $prevColumn);
            $objWriter->startElement('table:table-cell');
            $this->writeCellMerge($objWriter, $cell);

            // Style XF
            $style = $cell->getXfIndex();
            if ($style !== null) {
                $objWriter->writeAttribute('table:style-name', self::CELL_STYLE_PREFIX . $style);
            }

            switch ($cell->getDataType()) {
                case DataType::TYPE_BOOL:
                    $objWriter->writeAttribute('office:value-type', 'boolean');
                    $objWriter->writeAttribute('office:value', $cell->getValue());
                    $objWriter->writeElement('text:p', $cell->getValue());

                    break;
                case DataType::TYPE_ERROR:
                    throw new Exception('Writing of error not implemented yet.');

                    break;
                case DataType::TYPE_FORMULA:
                    $formulaValue = $cell->getValue();
                    if ($this->getParentWriter()->getPreCalculateFormulas()) {
                        try {
                            $formulaValue = $cell->getCalculatedValue();
                        } catch (Exception $e) {
                            // don't do anything
                        }
                    }
                    $objWriter->writeAttribute('table:formula', 'of:' . $cell->getValue());
                    if (is_numeric($formulaValue)) {
                        $objWriter->writeAttribute('office:value-type', 'float');
                    } else {
                        $objWriter->writeAttribute('office:value-type', 'string');
                    }
                    $objWriter->writeAttribute('office:value', $formulaValue);
                    $objWriter->writeElement('text:p', $formulaValue);

                    break;
                case DataType::TYPE_INLINE:
                    throw new Exception('Writing of inline not implemented yet.');

                    break;
                case DataType::TYPE_NUMERIC:
                    $objWriter->writeAttribute('office:value-type', 'float');
                    $objWriter->writeAttribute('office:value', $cell->getValue());
                    $objWriter->writeElement('text:p', $cell->getValue());

                    break;
                case DataType::TYPE_STRING:
                    $objWriter->writeAttribute('office:value-type', 'string');
                    $objWriter->writeElement('text:p', $cell->getValue());

                    break;
            }
            Comment::write($objWriter, $cell);
            $objWriter->endElement();
            $prevColumn = $column;
            $cells->next();
        }
        $numberColsRepeated = $numberColsRepeated - $prevColumn - 1;
        if ($numberColsRepeated > 0) {
            if ($numberColsRepeated > 1) {
                $objWriter->startElement('table:table-cell');
                $objWriter->writeAttribute('table:number-columns-repeated', $numberColsRepeated);
                $objWriter->endElement();
            } else {
                $objWriter->writeElement('table:table-cell');
            }
        }
    }
private function writeCells ( XMLWriter $ objWriter , Row $ row ) { $ numberColsRepeated = self :: NUMBER_COLS_REPEATED_MAX ; $ prevColumn = - 1 ; $ cells = $ row -> getCellIterator ( ) ; while ( $ cells -> valid ( ) ) { /** @var \PhpOffice\PhpSpreadsheet\Cell\Cell $cell */ $ cell = $ cells -> current ( ) ; $ column = Coordinate :: columnIndexFromString ( $ cell -> getColumn ( ) ) - 1 ; $ this -> writeCellSpan ( $ objWriter , $ column , $ prevColumn ) ; $ objWriter -> startElement ( 'table:table-cell' ) ; $ this -> writeCellMerge ( $ objWriter , $ cell ) ; // Style XF $ style = $ cell -> getXfIndex ( ) ; if ( $ style !== null ) { $ objWriter -> writeAttribute ( 'table:style-name' , self :: CELL_STYLE_PREFIX . $ style ) ; } switch ( $ cell -> getDataType ( ) ) { case DataType :: TYPE_BOOL : $ objWriter -> writeAttribute ( 'office:value-type' , 'boolean' ) ; $ objWriter -> writeAttribute ( 'office:value' , $ cell -> getValue ( ) ) ; $ objWriter -> writeElement ( 'text:p' , $ cell -> getValue ( ) ) ; break ; case DataType :: TYPE_ERROR : throw new Exception ( 'Writing of error not implemented yet.' ) ; break ; case DataType :: TYPE_FORMULA : $ formulaValue = $ cell -> getValue ( ) ; if ( $ this -> getParentWriter ( ) -> getPreCalculateFormulas ( ) ) { try { $ formulaValue = $ cell -> getCalculatedValue ( ) ; } catch ( Exception $ e ) { // don't do anything } } $ objWriter -> writeAttribute ( 'table:formula' , 'of:' . $ cell -> getValue ( ) ) ; if ( is_numeric ( $ formulaValue ) ) { $ objWriter -> writeAttribute ( 'office:value-type' , 'float' ) ; } else { $ objWriter -> writeAttribute ( 'office:value-type' , 'string' ) ; } $ objWriter -> writeAttribute ( 'office:value' , $ formulaValue ) ; $ objWriter -> writeElement ( 'text:p' , $ formulaValue ) ; break ; case DataType :: TYPE_INLINE : throw new Exception ( 'Writing of inline not implemented yet.' ) ; break ; case DataType :: TYPE_NUMERIC : $ objWriter -> writeAttribute ( 'office:value-type' , 'float' ) ; $ objWriter -> writeAttribute ( 'office:value' , $ cell -> getValue ( ) ) ; $ objWriter -> writeElement ( 'text:p' , $ cell -> getValue ( ) ) ; break ; case DataType :: TYPE_STRING : $ objWriter -> writeAttribute ( 'office:value-type' , 'string' ) ; $ objWriter -> writeElement ( 'text:p' , $ cell -> getValue ( ) ) ; break ; } Comment :: write ( $ objWriter , $ cell ) ; $ objWriter -> endElement ( ) ; $ prevColumn = $ column ; $ cells -> next ( ) ; } $ numberColsRepeated = $ numberColsRepeated - $ prevColumn - 1 ; if ( $ numberColsRepeated > 0 ) { if ( $ numberColsRepeated > 1 ) { $ objWriter -> startElement ( 'table:table-cell' ) ; $ objWriter -> writeAttribute ( 'table:number-columns-repeated' , $ numberColsRepeated ) ; $ objWriter -> endElement ( ) ; } else { $ objWriter -> writeElement ( 'table:table-cell' ) ; } } }
Write cells of the specified row.

@param XMLWriter $objWriter
@param Row $row

@throws Exception
Write cells of the specified row .