Formulas lost after read/insert/save

Topics: User Forum
Mar 7, 2008 at 3:12 PM
I'm trying to use PHPExcel to output a report from a PHP-Mysql based site.
What I've done is create a xlsx with all the required formating and formulea in, read it with PHPExcelReaderExcel2007 and then write values to some cells and output it stright to the browser.

All of this appears to work correctly, however having only put in three basic values and run a test, the resulting file looses many, but not all of the formulas from the original document.

here's the testing code I'm using,

$xoReader = new PHPExcelReaderExcel2007();
$xo = $xoReader->load("blanksummary.xlsx");

$xo->getProperties()->setTitle("xxxxxxx Summary Report ".date("d F Y"));
$xo->getProperties()->setSubject("xxxxxxx Summary Report ".date("d F Y"));
$xo->getProperties()->setDescription("xxxxxxx Summary Report ".date("d F Y"));

// Sling some vals in this array here
// rather than in all the queries that would occur to pull it from the db
$cells'B'3 = 25;
$cells'B'4 = 50;
$cells'B'5 = 100;

foreach($cells as $row => $columns){
foreach($columns as $column => $value){
$xo->getActiveSheet()->SetCellValue($row.$column, $value);

header("Content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
header("Content-disposition: attachment; filename=Summary-report-" . date("d-F-Y").".xlsx");
$objWriter = new PHPExcelWriterExcel2007($xo);
$objWriter->save(str_replace('.php', '.xlsx', "php://output"));

A zip containing the loaded and resulting files can be found at

I am using the latest SVN version to as I was earlier having the problem listed in work item 5517

Any help would be appreciated.
Mar 10, 2008 at 10:35 AM
Sounds like we need to implement shared formulas in the Reader... Will create a work item!
Mar 10, 2008 at 10:36 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.