Reputation: 311
I'm generating a Excell 2003 using PHPExcel 1.8 with this code:
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('toUploadFtp.xls');
The file seems ok, and I can read it using MS Office and LibreOffice.
But I have to upload the file to a system that says the format has to be Excell 2003, and he prompts next error:
Oops! Your file is not in the proper Microsoft Excel 2003 XLS format.
If I open the file with LibreOffice and save it again, then I can upload the file correctly to the system.
Any idea?
Thanks,
Upvotes: 3
Views: 5654
Reputation: 311
Finally I couldn't find a solution. It has to be some kind of bug in the XLS 2003 format.
But I generated a XLSX with $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
and the system recognizes it correctly.
Upvotes: 1
Reputation: 109532
Not understanding the exact problem entirely: it seems to be with the additional transfer of the Excel file.
One error is often, that the PHP script outputs spurious data.
Leaving out the final %>
is a standard trick to make sure no extra final new line characters are added to the file.
Comparing the files generated and transferred should yield insight on what went wrong.
You may need to set the content to non-text to prevent some text conversion:
header('Content-Type: application/octet'):
Upvotes: 1
Reputation: 6252
I think you can overcome this problem in changing the filed of Excel5
.Since i havnt tried phpexcel i dont know much about this..But i think you can find a solution for this [here].1
Upvotes: 0
Reputation: 120990
Create your file by passing the proper version to factory:
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
Hope it helps.
Upvotes: 3