Disabling the calculation cache

Topics: Developer Forum
May 27, 2008 at 3:46 PM
I wonder ..

Is there an elegant way to disable the calculation cache in PHPExcel_Calculation? I want to calculate the value of a cell with different inputs (with different values of another cell).

As far as I can see, PHPExcel_Calculation hasn't got a method to disable the cache, to lower the cache time to 0 or to clear the contents of the cache.
May 27, 2008 at 4:29 PM
Will create a work item for that... http://www.codeplex.com/PHPExcel/WorkItem/View.aspx?WorkItemId=6264
May 27, 2008 at 5:03 PM
The most ultimate solution would be if the calculation cache stays intact until a value is changed on a worksheet.

Of course that can be handled by the programmer, but then there needs to be a clearCalcultationCache() method.

    echo 'A2: ' . $phpExcel->getSheet(0)->getCell('A2')->getCalculatedValue() . '<br />';
    echo 'A3: ' . $phpExcel->getSheet(0)->getCell('A3')->getCalculatedValue() . '<br />';


    echo 'Now setting A1 to a different value ...<br />';
    echo 'New A2: ' . $phpExcel->getSheet(0)->getCell('A2')->getCalculatedValue() . '<br />';
    echo 'New A3: ' . $phpExcel->getSheet(0)->getCell('A3')->getCalculatedValue() . '<br />';
May 28, 2008 at 8:50 AM
Should I have checked the latest SVN first before writing the last post?

Man, you're fast! clearCalculationCache() exists in the latest SVN. Now my code is not more than an example of how to use it (except for that missing semicolon on line 5) :)

May 28, 2008 at 10:43 AM
No problem! :-)