PHPExcel template - empty output file

Topics: Developer Forum, Project Management Forum, User Forum
Aug 20, 2012 at 10:47 AM
Edited Sep 26, 2012 at 4:57 PM

PHP Version = 5.3.8
Operating System = Windows XP
PHPExcel Version = version 1.7.6

Hi All,

I am having trouble trying populating a template using PHPExcel, I tried to populate the data using Set Value on the cell or SetCellValue on the work sheet but they didn't work. I got a blank excel output. I tried a no format template and it gives the same result.

Here is my code:

$objPHPexcel = PHPExcel_IOFactory::load($Location.$fileName);
$objWorksheet = $objPHPexcel->getActiveSheet();                
#    Also tried $objPHPexcel->getActiveSheet()->setCellValue('A13','MyName',true);
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="myfile.xlsx"');
header('Cache-Control: max-age=0');     
$objWriter = PHPExcel_IOFactory::createWriter($objPHPexcel, 'Excel2007');

Any help would be much appreciated