I'm trying to evaluate the following formular in my XSLX workbook with PHPExcel 1.7.9: =IF($H$7=1,$F$13,$H$227*$J$227)
Before I have to update some cells in the workbook and then I use this line to calculate the value:
$sheet->getCell('L228')->getCalculatedValue();
However, PHPExcel seems not to update the cell which contains the formula correctly. It throws out some notice messages like the following but doesn't update the cell's calculated value:
Notice: Undefined offset: 2 in D:\my-path\hkc\Classes\PHPExcel\Calculation.php on line 2852
There's no exception and it seems that getCalculatedValue() returns the old cached value calculated by MS Excel. As pointed out below, I've activated debug logging of the calculation engine but it seems to be empty:
PHPExcel_CalcEngine_Logger Object
(
[_writeDebugLog:PHPExcel_CalcEngine_Logger:private] =>
[_echoDebugLog:PHPExcel_CalcEngine_Logger:private] =>
[_debugLog:PHPExcel_CalcEngine_Logger:private] => Array
(
)
[_cellStack:PHPExcel_CalcEngine_Logger:private] => PHPExcel_CalcEngine_CyclicReferenceStack Object
(
[_stack:PHPExcel_CalcEngine_CyclicReferenceStack:private] => Array
(
)
)
)
I've tried the following steps to solve the problem:
- Deactivate calculation cache:
PHPExcel_Calculation::getInstance()->setCalculationCacheEnabled(FALSE); - Activate debug mode of calculation engine: This is described in How to handle exception with PhpExcel? and especially http://phpexcel.codeplex.com/discussions/233047
However, I had to modify the code of the referenced pages slightly - maybe something has changed in PHPExcel 1.7.9?
Activate debug:PHPExcel_Calculation::getInstance()->writeDebugLog = true;
Get debug log:print_r(PHPExcel_Calculation::getInstance()->getDebugLog());
I don't get it why the actual log of the engine is empty? Either the engine stops working before it writes out any entries or something is wrong with my debugging configuration?
However, the I've tried to evaluate the same formula with Java and Apache POI - it worked! Unfortunately I've to use PHP for the current project.
Please help me! Maybe somebody knows what's wrong with the formula evaluation or at least can give me some hints how to activate debugging properly?
Thanks!