Using PHPExcel 1.7.9, I read the Excel template and fill in the values in specific cells just before sending the file to the user.
The template is filled with range formulas that calculate the totals for columns and rows. The problem is that regardless of the value of the formula, it is always set to 0 using Writer, and does not remain empty (which is the actual behavior of Excel).
I tried to use the method $objWriter->setPreCalculateFormulas(false);, but to no avail.
Of course, it would be possible to rewrite all the formulas and apply the conditions to circumvent the problem, but it is not perfect and looks rather crowded.
Just for information, here is my Writer code:
$objWriter = new PHPExcel_Writer_Excel2007($obj);
$objWriter->setPreCalculateFormulas(false);
PHPExcel_Calculation::getInstance($obj)->clearCalculationCache();
$objWriter->save('php://output');
exit;
What am I missing?
Thanks in advance for your help!
source
share