Problem downloading workbook with charts

Topics: Developer Forum, User Forum
Mar 28, 2013 at 4:17 PM
Edited Mar 28, 2013 at 4:17 PM
Hi all,

at the moment I create a workbook with charts and save it on the server by using
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->setIncludeCharts(TRUE);

$filename="charts/Charts-".$User.".xlsx";
$objWriter->save(str_replace('antr_stat_vergleich_charts.php', $filename, __FILE__));
I'd rather like to use the functionality of direct downloading I use in another file:
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename='.$filename);
header('Cache-Control: max-age=0');

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
exit;
But
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename='.$filename);
header('Cache-Control: max-age=0');

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('php://output');
exit;
isn't working, it creates workbooks without charts.

Any hint would be appreciated.

Regards
Christian
Coordinator
Mar 28, 2013 at 4:22 PM
You're forgetting
$objWriter->setIncludeCharts(TRUE);
Mar 28, 2013 at 4:24 PM
Edited Mar 28, 2013 at 4:27 PM
I just saw it myself. It works now.

Thanks for your reply!