Excel2007 Reader getCalculatedValue

Topics: Developer Forum, User Forum
Oct 28, 2009 at 5:02 PM
Edited Oct 28, 2009 at 5:03 PM

I have a worksheet with the following formula in it;

=IF(I2>0.01, (100-I2)*G2/100, J2*H2)

in the worksheet the cell has a value of 0, when using the following code the value of the cell is #VALUE!

echo date('H:i:s') . " Load new PHPExcel object <br />";
    $objReader = new PHPExcel_Reader_Excel2007();
    $objPHPExcel = $objReader->load("SAJ0001L.xlsx");
    $sheet = $objPHPExcel->getActiveSheet();

    echo date('H:i:s') . " PHPExcel object loaded <br />";

    foreach ($sheet->getRowIterator() as $row) {
        $cellIterator = $row->getCellIterator();
        foreach ($cellIterator as $cell) {
            echo $cell->getCalculatedValue() ." : ";
        echo "<br />";

Oct 29, 2009 at 1:06 AM

What are the values in the cells G2 - J2 that are used in the formula?

Are there, for example, any blank cells? or any non-numeric values? If so, then the problem may be resolved by the latest SVN code which fixes work item 10799

Nov 3, 2009 at 9:32 AM

Hi Mark

This is now fixed using the latest stable release 1.7.1