Need Guidance

Nov 1, 2010 at 3:26 PM

I'm new to PHPExcel and am hoping to be pointed in the right direction. In older version of PHPExcel my pages work perfect. When I update to new version 1.7.4 I get the following error. Can you point me in the right direction of where to start troubleshooting this as I am clueless. The reason I need to update is it fixes one item but breaks others..


[Mon Nov 01 10:50:46 2010] [error] [client] PHP Fatal error:  Uncaught exception 'Exception' with message 'Report!P3 -> Formula Error: An unexpected error occured' in /usr/share/php/PHPExcel/Cell.php:272\nStack trace:\n#0 /usr/share/php/PHPExcel/Writer/Excel5/Worksheet.php(443): PHPExcel_Cell->getCalculatedValue()\n#1 /usr/share/php/PHPExcel/Writer/Excel5.php(177): PHPExcel_Writer_Excel5_Worksheet->close()\n#2 /usr/share/php/xlsWriter.php(63): PHPExcel_Writer_Excel5->save('php://output')\n#3 /usr/share/php/xlsWriter.php(26): xlsWriter->buildXLS5()\n#4 /var/www/appsrv/wo/paintline/paintsystem_xls.php(1132): xlsWriter->build()\n#5 {main}\n  thrown in /usr/share/php/PHPExcel/Cell.php on line 272, referer: http://appsrv3/wo/paintline/paintsystem.php?l=5c0ba53eaf9b6d6c71ca4ca53dae2756

Nov 1, 2010 at 9:49 PM

With any formula error, the best way to help debug it is to enable logging for the calculation engine:

PHPExcel_Calculation::getInstance()->writeDebugLog = true;

and then execute the calculation engine:

function testFormula($sheet,$cell) {
   $formulaValue = $sheet->getCell($cell)->getValue();
   echo '<b>'.$cell.' Value is </b>'.$formulaValue."<br />\n";
   $expectedValue = $sheet->getCell($cell)->getOldCalculatedValue();
   echo '<b>'.$cell.' Expected Value is </b>'.$expectedValue."<br />\n";

   echo '<b>Parser Stack :-</b><pre>';
   $tokens = PHPExcel_Calculation::getInstance()->parseFormula($formulaValue,$sheet->getCell($cell));
   echo '</pre>';

   try {
      $cellValue = $sheet->getCell($cell)->getCalculatedValue();
      echo '<b>'.$cell.' Calculated Value is </b>'.$cellValue."<br />\n";
      echo '<h3>Evaluation Log:</h3><pre>';
      echo '</pre>';
   } catch (Exception $e) {
      echo "CALCULATION ENGINE ERROR: ".$e->getMessage()."<br />\n";
      echo '<h3>Evaluation Log:</h3><pre>';
      echo '</pre>';



Nov 2, 2010 at 4:51 PM

What file would I enable logging in?

Nov 2, 2010 at 10:22 PM

I'd assume in xlsWriter.php ... we need to identify which formula is causing the problem before we can try to find out why it's a problem.