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!