0

First time, i change a static document values with this code

$path = 'xtelcom.xlsx';
            $objReader = PHPExcel_IOFactory::createReader('Excel2007');
            $objReader->setReadDataOnly(true);
            $excel_import = $objReader->load($path);
            $excel_import->setActiveSheetIndex(0);
            $excel_import->getActiveSheet()->setCellValue('B1', '50');

            $objWriter = PHPExcel_IOFactory::createWriter($excel_import, 'Excel2007');
            $objWriter->save('new_calcule.xlsx');

And the file 'new_calcule.xlsx' is ok with my value there, but when i try to get the Formatted Value from some cells i get my page blank, dead, very important the excel file is big and i need cyclicFormulaCount to work i get.

Fatal error: Uncaught exception 'PHPExcel_Calculation_Exception' with message 'Sheet1!F9 -> Sheet1!F9 -> Sheet1!F9 -> Sheet1!F9 -> Sheet1!F9 -> Sheet1!F9 -> Sheet1!F9 -> Sheet1!F9 -> Sheet1!F9 -> Sheet1!F9 -> Sheet1!F9 -> Sheet1!F9 -> Cyclic Reference in Formula' in /home/xtelro/public_html/easyb.ro/ec/inc/Classes/PHPExcel/Cell.php:300 Stack trace: #0 /home/xtelro/public_html/easyb.ro/ec/inc/Classes/PHPExcel/Cell.php(201): PHPExcel_Cell->getCalculatedValue() #1 /home/xtelro/public_html/easyb.ro/ec/admin/imp.php(66): PHPExcel_Cell->getFormattedValue() #2 {main} thrown in /home/xtelro/public_html/easyb.ro/ec/inc/Classes/PHPExcel/Cell.php on line 300

include '../inc/Classes/PHPExcel/IOFactory.php';
            $objReader2 = PHPExcel_IOFactory::createReader('Excel2007');
            $excel_import2 = $objReader2->load('new_calcule.xlsx');
            $excel_import2->setActiveSheetIndex(0);
            PHPExcel_Calculation::getInstance($excel_import2)->cyclicFormulaCount = 10000;

            $figaro1 = $excel_import2->getActiveSheet()->getCell('K23')->getFormattedValue();
            echo 'Pret vechi:' . $figaro1;
            $figaro2 = $excel_import2->getActiveSheet()->getCell('L23')->getFormattedValue();
            echo 'Pret nou:' . $figaro2;
            $figaro3 = $excel_import2->getActiveSheet()->getCell('M23')->getFormattedValue();
            echo 'Pret minim admis:' . $figaro3;

Must show echos but my scrip just die without any error, can you help me to fix and understand this ? Thanks!

Malasuerte94
  • 1,454
  • 3
  • 14
  • 18
  • 2
    Possible duplicate of [PHP's white screen of death](http://stackoverflow.com/questions/1475297/phps-white-screen-of-death) – Sherif Sep 19 '16 at 13:12
  • Possible duplicate of [PHPExcel error cyclic reference in formula](http://stackoverflow.com/questions/13786887/phpexcel-error-cyclic-reference-in-formula).... Do you really need `cyclicFormulaCount = 10000` so high? That's probably putting PHPExcel into a cyclic formula loop until it times out – Mark Baker Sep 19 '16 at 13:20
  • If i put = 1 i got the same result – Malasuerte94 Sep 19 '16 at 13:22
  • now i get this valuePret vechi:#DIV/0!Pret nou:#DIV/0!Pret minim admis:#VALUE! – Malasuerte94 Sep 19 '16 at 13:48

0 Answers0