Reputation:
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)
Does anybody have an idea?
Upvotes: 1
Views: 1148
Reputation: 7671
PHPExcel does not currently support charts so charts will not be saved if you open a document with charts. For a workaround try the method described here (only works with xlsx)
Upvotes: 1