Open the Excel file in a text editor, and look for any leading or trailing whitespace characters, or a leading BOM header, or any obvious plaintext error messages that yoru session handler might be injecting into the output stream
The most common cause of this problem is whitespace that's echoed to output (perhaps after a closing ?>
).
Using output buffering, and then discarding the buffer immediately before the call to save() is a common workround; but better to fix the problem rather than simply hiding it with output buffering. You'll notice that none of the PHPExcel code has any closing ?>
to ensure that it's impossible for the library itself to cause this problem