Unable to load file with createReader('Excel 5')

Topics: Developer Forum, User Forum
Nov 3, 2014 at 9:10 PM
I'm porting a previously working PHPExcel configuration to a new website that has a different back end than the one it had worked on before.

I stripped my Excel output function of anything extra, and am simply trying to read an empty, barebones, template file with createReader and output it with createWriter.

The resulting file I get has a bunch of hieroglyphics that start with:
ÐÏࡱá;þÿ

Earlier discussions that had this kind of output suggested that markup may have already been output but I don't think that is the case. I would expect a "headers already sent out" warning and I don't see any markup when exiting before the output file is generated. It's certainly possible I'm missing a blank space though as I'm still familiarizing myself with the new back end.
Coordinator
Nov 3, 2014 at 10:25 PM
Those "hieroglyphs" are the binary stream for the Excel5 file. If you're sending this to a browser, then you need to send the appropriate headers for a BIFF-format Excel file, as shown in 01simple-download-xls.php
Nov 4, 2014 at 2:29 AM
Hi Mark,

Thank you for the response. I had the headers setup as shown in 01simple-download-xls.php and an excel file was downloaded that contained the glyphs.

The new URL routing system our site used caused this error (was being redirected through the PHPExcel handling twice hence an Excel file being created AND it containing Excel headers in the actual file).

I'm bypassing the routing system to get this to work now. We also had some PHP files that opened PHP tags to late in the file (leaving empty whitespace in the beginning) or closed PHP tags too early (leaving empty whitespace at the end). These had to be corrected as well to get the output to work correctly. Thanks again.