Chart not loaded in PHPExcel

Hi, I just downloaded the xlsx file with the graph, but the graph does not appear on the output.

This is my code:

 $objPHPExcel=$objPHPExcel_new = new PHPExcel();
$objReader = PHPExcel_IOFactory::createReader('Excel2007');
$objPHPExcel = $objReader->load("../Graph_sample.xlsx");



$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('result.xlsx'); 
+4
source share
1 answer

Since most users do not want to load diagrams by default (loading / saving diagrams is speed and out of memory), you must explicitly tell PHPExcel that you want to load them using setIncludeCharts():

$objPHPExcel=$objPHPExcel_new = new PHPExcel();
$objReader = PHPExcel_IOFactory::createReader('Excel2007');
$objReader->setIncludeCharts(TRUE);
$objPHPExcel = $objReader->load("../Graph_sample.xlsx");

and when writing

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->setIncludeCharts(TRUE);
$objWriter->save('result.xlsx'); 
+6
source

All Articles