private function PHPExcel_Writer_OpenDocument_Content::_writeCells in Loft Data Grids 7.2
Same name and namespace in other branches
- 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/OpenDocument/Content.php \PHPExcel_Writer_OpenDocument_Content::_writeCells()
Write cells of the specified row
Parameters
PHPExcel_Shared_XMLWriter $objWriter:
PHPExcel_Worksheet_Row $row:
Throws
1 call to PHPExcel_Writer_OpenDocument_Content::_writeCells()
- PHPExcel_Writer_OpenDocument_Content::_writeRows in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Writer/ OpenDocument/ Content.php - Write rows of the specified sheet
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Writer/ OpenDocument/ Content.php, line 183
Class
- PHPExcel_Writer_OpenDocument_Content
- PHPExcel_Writer_OpenDocument_Content
Code
private function _writeCells(PHPExcel_Shared_XMLWriter $objWriter, PHPExcel_Worksheet_Row $row) {
$number_cols_repeated = self::NUMBER_COLS_REPEATED_MAX;
$prev_column = -1;
$cells = $row
->getCellIterator();
while ($cells
->valid()) {
$cell = $cells
->current();
$column = PHPExcel_Cell::columnIndexFromString($cell
->getColumn()) - 1;
$this
->_writeCellSpan($objWriter, $column, $prev_column);
$objWriter
->startElement('table:table-cell');
switch ($cell
->getDataType()) {
case PHPExcel_Cell_DataType::TYPE_BOOL:
$objWriter
->writeAttribute('office:value-type', 'boolean');
$objWriter
->writeAttribute('office:value', $cell
->getValue());
$objWriter
->writeElement('text:p', $cell
->getValue());
break;
case PHPExcel_Cell_DataType::TYPE_ERROR:
throw new PHPExcel_Writer_Exception('Writing of error not implemented yet.');
break;
case PHPExcel_Cell_DataType::TYPE_FORMULA:
try {
$formula_value = $cell
->getCalculatedValue();
} catch (Exception $e) {
$formula_value = $cell
->getValue();
}
$objWriter
->writeAttribute('table:formula', 'of:' . $cell
->getValue());
if (is_numeric($formula_value)) {
$objWriter
->writeAttribute('office:value-type', 'float');
}
else {
$objWriter
->writeAttribute('office:value-type', 'string');
}
$objWriter
->writeAttribute('office:value', $formula_value);
$objWriter
->writeElement('text:p', $formula_value);
break;
case PHPExcel_Cell_DataType::TYPE_INLINE:
throw new PHPExcel_Writer_Exception('Writing of inline not implemented yet.');
break;
case PHPExcel_Cell_DataType::TYPE_NUMERIC:
$objWriter
->writeAttribute('office:value-type', 'float');
$objWriter
->writeAttribute('office:value', $cell
->getValue());
$objWriter
->writeElement('text:p', $cell
->getValue());
break;
case PHPExcel_Cell_DataType::TYPE_STRING:
$objWriter
->writeAttribute('office:value-type', 'string');
$objWriter
->writeElement('text:p', $cell
->getValue());
break;
}
PHPExcel_Writer_OpenDocument_Cell_Comment::write($objWriter, $cell);
$objWriter
->endElement();
$prev_column = $column;
$cells
->next();
}
$number_cols_repeated = $number_cols_repeated - $prev_column - 1;
if ($number_cols_repeated > 0) {
if ($number_cols_repeated > 1) {
$objWriter
->startElement('table:table-cell');
$objWriter
->writeAttribute('table:number-columns-repeated', $number_cols_repeated);
$objWriter
->endElement();
}
else {
$objWriter
->writeElement('table:table-cell');
}
}
}