Problem of copying the chart?

Topics: Developer Forum, User Forum
Jun 25, 2009 at 10:57 AM

Hi everybody.

With PHPExcel 1.6.7, i tried to clone a excel file, insert a word in a cell of sheet1 of new file and then save it :

$file = "file.xls";
$fp = fopen($file, "r"); 
$objReader = new PHPExcel_Reader_Excel5();
$xls = $objReader->load($file);
//$xls->setActiveSheetIndex(0) ;

$xls->getSheetByName('sheet1')->setCellValue('A2', 'bbb') ;

$newxls = clone $xls ;
			
$newfile = "newfile.xls" ;
$xlsfile = new PHPExcel_Writer_Excel5($newxls);
$xlsfile->save($newfile);

The problem is : there should be a chart in sheet2, but the chart disappeared in the new file (as i just modified the sheet1)

Anybody has idea?

Thanks a lot

Developer
Jun 27, 2009 at 12:34 AM

This probably does not have to do with the cloning. If you try to do a plain read/write of the Excel file using PHPExcel you will notice that the chart is gone. Unfortunately, charts are not yet supported by PHPExcel.

You may vote for this work item:
http://phpexcel.codeplex.com/WorkItem/View.aspx?WorkItemId=16