mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2024-11-26 07:16:03 +03:00
Merge pull request #397 from goncons/develop
Open Document cell with not numeric formula
This commit is contained in:
commit
0e14e41299
@ -205,12 +205,16 @@ class PHPExcel_Writer_OpenDocument_Content extends PHPExcel_Writer_OpenDocument_
|
|||||||
|
|
||||||
case PHPExcel_Cell_DataType::TYPE_FORMULA:
|
case PHPExcel_Cell_DataType::TYPE_FORMULA:
|
||||||
try {
|
try {
|
||||||
$formula_value = PHPExcel_Calculation::getInstance()->calculateCellValue($cell);
|
$formula_value = $cell->getCalculatedValue();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$formula_value = $cell->getValue();
|
$formula_value = $cell->getValue();
|
||||||
}
|
}
|
||||||
$objWriter->writeAttribute('table:formula', 'of:' . $cell->getValue());
|
$objWriter->writeAttribute('table:formula', 'of:' . $cell->getValue());
|
||||||
|
if (is_numeric($formula_value)) {
|
||||||
$objWriter->writeAttribute('office:value-type', 'float');
|
$objWriter->writeAttribute('office:value-type', 'float');
|
||||||
|
} else {
|
||||||
|
$objWriter->writeAttribute('office:value-type', 'string');
|
||||||
|
}
|
||||||
$objWriter->writeAttribute('office:value', $formula_value);
|
$objWriter->writeAttribute('office:value', $formula_value);
|
||||||
$objWriter->writeElement('text:p', $formula_value);
|
$objWriter->writeElement('text:p', $formula_value);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user