Header (' Content-type:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet '); Header (' Content-disposition:attachment;filename= "fee_detail.xlsx"); header (' cache-control:max-age=0 '); $objWriter = Phpexcel_iofactory::createwriter ($objPHPExcel, ' Excel2007 '); $objWriter->save (' php://output ');
Why the xlsx file could not be generated.
Header (' Content-type:application/vnd.ms-excel '); header (' Content-disposition:attachment;filename= ' fee_ Detail.xls "'); header (' cache-control:max-age=0 '); $objWriter = Phpexcel_iofactory::createwriter ($objPHPExcel, ' Excel5 '); $objWriter->save (' php://output ');
You can generate an XLS file.
Reply to discussion (solution)
Cannot generate XLSX, do you have an error message? or other informational messages
Tested to generate. xlsx, you $objwriter->save (' Php://output '), followed by exit (); try it.
Cannot generate XLSX, do you have an error message? or other informational messages
There is no error message, I added the following code in the header of the file, you can generate the xlsx file
Ini_set (' display_errors ', true); Ini_set (' display_startup_errors ', true);
However, a problem has been encountered that does not open the file, prompting "the file format or file name extension is invalid." Please make sure the file does not harm ... "information.
I think the code should be fine, this set of code can generate the XLS file, and can open the XLS file.
Tested to generate. xlsx, you $objwriter->save (' Php://output '), followed by exit (); try it.
Exit (); It's always been.
I added the following code to the file header to generate the xlsx file
Ini_set (' display_errors ', true); Ini_set (' display_startup_errors ', true);
However, a problem has been encountered that does not open the file, prompting "the file format or file name extension is invalid." Please make sure the file does not harm ... "information.
I think the code should be fine, this set of code can generate the XLS file, and can open the XLS file.
The reason was found, ziparchive not found
Configuration of the php.ini file, the problem solved.