Writer_Excel5 & Charts

Topics: User Forum
Sep 12, 2013 at 1:01 PM
Hi folks,

i've read a lot here about charts from existing Excel-Files and would ask if i had understood correctly.

Charts readed from or writed to Excel5 are not supported.

Charts readed from and writed to Excel2007 are supported.

I will only put it in a nutshell w/o going deeply into code/restictions ;-)

Thanks and have a nice day.
Sep 12, 2013 at 1:18 PM
Edited Sep 13, 2013 at 9:22 AM
Ok ... that was a bit to hasty ...

Maybe i should say a little bit to what i want to do.

I have an Excel5-File with 30 sheets. 15 sheets are filled with data / the other 15 sheets are only charts to display the numbers from the sheets in front.

All my trys to load the Workbook and save a new Workbook after add my data to sheets 1-15 (what i did without any problems) ended in an Workbook without any charts.

I had played with PHPExcel 1.7.9, 1.7.6 and 1.6.7.
I had used the writer for 2005 and 2007 ... but my source file (2005/.xls) will be untouched.

My last try was to save my Excel2005-File in OfficeXP to 2007-Format (.xlsx) without luck.

Last of all my code of my last try:
require_once "PHPExcel/IOFactory.php";
$objTpl = PHPExcel_IOFactory::load("XLS-Files/testFile.xlsx");

$objTpl->setActiveSheetIndex(0);  //set first sheet as active
$objTpl->getActiveSheet()->setCellValue('C2', "SampleData11");
$objTpl->getActiveSheet()->setCellValue('C3', "SampleData12");
$objTpl->getActiveSheet()->setCellValue('C4', "SampleData13");

$objTpl->getActiveSheet()->setCellValue('C2', "SampleData21");
$objTpl->getActiveSheet()->setCellValue('C3', "SampleData22");
$objTpl->getActiveSheet()->setCellValue('C4', "SampleData23");

$objWriter = PHPExcel_IOFactory::createWriter($objTpl, 'Excel2007');
Sep 12, 2013 at 3:42 PM
No playing with charts myself, but, afaik, you must ask the reader and the writer to use charts with a call to setIncludeCharts(TRUE).
See example 32 for a complete example of reading and writing with charts.
Sep 13, 2013 at 7:53 AM
Hi LWol,

played a little bit with setIncludeCharts and getIncludeCharts but i can't see any changes.
The resulting workbook has no charts in it.

Thanks anyway for your help!
Sep 13, 2013 at 10:11 AM
Edited Sep 13, 2013 at 10:12 AM
My last (not working) try was:
require_once "PHPExcel/IOFactory.php";
$objReader = PHPExcel_IOFactory::createReader('Excel5');
$objTpl = $objReader->load("XLS-Files/testFile.xls");

$objWriter = PHPExcel_IOFactory::createWriter($objTpl, 'Excel5');
I have try Excel5/Excel2007 as reader an writer in any constallation.
With 2007 as writer ans reader i get an larger .xlsx-File what indicated that inside some charts ... but i cant open this file with Excel 2002.
Sep 13, 2013 at 11:52 AM
Well... as you write : "Charts readed from or writed to Excel5 are not supported. "