页面空白,用phpexcel模具提取formattvalue?

时间:2016-09-19 13:11:30

标签: php excel phpexcel formula phpexcel-1.8.0

第一次,我使用此代码更改静态文档值

$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');

文件' new_calcule.xlsx'我的价值在那里是好的,但是当我试图从某些单元格中获取格式化值时,我的页面空白,死了,非常重要excel文件很大,我需要使用cyclicFormulaCount来工作。

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;

必须显示回声,但我的脚本没有任何错误就死了,你能帮我解决一下吗?谢谢!

0 个答案:

没有答案