phpexcel1.7.7 Fatal error: Call to a member function children() on a non-object in Classes\PHPExcel\Reader\Excel2007.php on line 1519

Topics: Project Management Forum
May 24, 2012 at 5:01 PM
Hello all, i downloaded phpexcel 1.7.7 and was trying to modify an existing excel file containing charts but when i run it gives following error: Fatal error: Call to a member function children() on a non-object in Classes\PHPExcel\Reader\Excel2007.php on line 1519 My php code====> <?php error_reporting(E_ALL); date_default_timezone_set('Europe/London'); include "PhpExcelNew1/Classes/PHPExcel/IOFactory.php"; $inputFileType = 'Excel2007'; $inputFileName = 'CQM_ControlChart_EV_Dev_OctDec2011.xlsx'; $objReader = PHPExcel_IOFactory::createReader($inputFileType); $objReader->setIncludeCharts(TRUE); $objPHPExcel = $objReader->load($inputFileName); foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) { echo "\ninside\n
"; $sheetName = $worksheet->getTitle(); echo 'Worksheet: ' , $sheetName , PHP_EOL; $chartNames = $worksheet->getChartNames(); if(empty($chartNames)) { echo ' There are no charts in this worksheet' , PHP_EOL; } else { natsort($chartNames); foreach($chartNames as $i => $chartName) { $chart = $worksheet->getChartByName($chartName); if (!is_null($chart->getTitle())) { $caption = '"' . implode(' ',$chart->getTitle()->getCaption()) . '"'; } else { $caption = 'Untitled'; } echo ' ' , $chartName , ' - ' , $caption , PHP_EOL; echo str_repeat(' ',strlen($chartName)+3); $groupCount = $chart->getPlotArea()->getPlotGroupCount(); if ($groupCount == 1) { $chartType = $chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotType(); echo ' ' , $chartType , PHP_EOL; } else { $chartTypes = array(); for($i = 0; $i < $groupCount; ++$i) { $chartTypes[] = $chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType(); } $chartTypes = array_unique($chartTypes); if (count($chartTypes) == 1) { $chartType = 'Multiple Plot ' . array_pop($chartTypes); echo ' ' , $chartType , PHP_EOL; } elseif (count($chartTypes) == 0) { echo ' *** Type not yet implemented' , PHP_EOL; } else { echo ' Combination Chart' , PHP_EOL; } } } } } $outputFileName = "newChartResults.xlsx";//basename($inputFileName); $outputFileName1 = basename($outputFileName); $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); $objWriter->setIncludeCharts(TRUE); $objWriter->save($outputFileName1); echo date('H:i:s') , " File written to " , $outputFileName1 , PHP_EOL; $objPHPExcel->disconnectWorksheets(); unset($objPHPExcel); ?> any suggestion/help would be appreciated. Thanks in advance.
Coordinator
May 24, 2012 at 8:18 PM

Is it possible for you to upload the workbook that is generating this error?

May 25, 2012 at 3:48 AM
MarkBaker wrote:

Is it possible for you to upload the workbook that is generating this error?

Hi mark thanks for your reply...i have uploaded the file(WorkbookChartExcel.xlsx) under issue tracker!!

any suggestion how to fix the error??

thanks in advance!!!

May 25, 2012 at 3:48 AM
MarkBaker wrote:

Is it possible for you to upload the workbook that is generating this error?

Hi mark thanks for your reply...i have uploaded the file(WorkbookChartExcel.xlsx) under issue tracker!!

any suggestion how to fix the error??

thanks in advance!!!

May 25, 2012 at 7:28 AM

@mark when i am running the same code after integrating it to my application m getting following error===>

Fatal error:  Failed opening required 'PHPExcel_Shared_ZipStreamWrapper.class.php'

and also i can not see php_xml.dll option in php.ini

 

can you suggest me how to fix the issue??

thanks!!