Save as with Excel2007

I cannot get my worksheet to open when I attempt to download it through the browser. I am passing the download headers, saving to disk and using fpassthru to try to send it to the user. The version I pull directly off the server gets the unreadable content
errors, but it does open. The version that I save or open through the browser gives me an invalid file format error and will not open. any ideas?

When I save directly to the server the only error I get with the file is an unreadable content error. The file opens and cleans up fine when I get the file from the server. I am on a Unix/Apache server if that helps anything.

In that case you may have missed the guidelines from the documentation when sending files directly to browser:

Make sure not to include any echo statements or output any other contents than the Excel file. There should be no whitespace before the opening
<?php tag and at most one line break after the closing ?> tag (which can also be omitted to avoid problems).

Make sure that your script is saved without a BOM (Byte-order mark). (Because this counts as echoing output)

Same things apply to all included files

If you think you are doing everything right, compare downloaded file with file saved on server disk. They should look the same in a HEX editor. Try to find out how they differ. Usually there is prepended or appended some stray characters (may even be just white
space) because one or more of the above guidelines are violated.