I’m stuck with this problem, it’s not displaying the actual excel file.
“Excel cannot open the file ‘filename.xlsx’ because the file format for the file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file.”
I got it working now! Thanks to this phpexcel to download
I changed the code to this:
// Save Excel 2007 file
#echo date(‘H:i:s’) . ” Write to Excel2007 formatn”;
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, ‘Excel2007′);
// We’ll be outputting an excel file
// It will be called file.xls
header(‘Content-Disposition: attachment; filename=”payroll.xlsx”‘);
I think this line:
solved my problem.