Using Excel Template with Graph - Missing Components

Topics: Developer Forum, User Forum
Mar 12, 2013 at 12:08 PM
Hi All,

I've been trying to copy a graph that is in an Excel template. With the aim of updating the graph by using PHPExcel to modify the associated data.

I've used the 30template.php example to achieve a lot of this, though it is missing the title, labels and doesn't keep the colours that I set.

The relevant snippets are:

$inputFileType = 'Excel2007';
$inputFileName = '/var/www/ReportTemplates/ExcelReportTemplate.xlsx';

$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$objReader->setIncludeCharts(TRUE);
$objPHPExcel = $objReader->load($inputFileName);

header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="Excel_Report.xlsx"');
header('Cache-Control: max-age=0');

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->setIncludeCharts(TRUE);
$objWriter->save('php://output');

I can see how these components are set when creating a new graph, though not when using a template. I've hunted around for quite a while though no luck.

Am I missing something?