Okay, I’m generating a table that I want to export to excel. I’ve tried exporting the table in text-tab delimited, basic table (no class/id affixed), and the table as generated naturally (with css class and id parameters). Every time I try this, I receive the following error:
[code]
The file you are trying to open {FILENAME} is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?
The file opens and the data is there and formatted correctly. I’m trying to get rid of the error.
I’m pretty sure that I’m either getting this error because I’ve set the headers wrong, or I’m somehow screwing up the table, but I haven’t found anything on the web that seems to point to how to do it correctly. People just stop responding after folks ask how the table is generated.
So here are the headers:
[code=php]
header(“Content-type: application/vnd.ms-excel”);
header(“Content-Disposition: attachment; filename=excelfile.xls”);
echo $formatter->formatReport( “”, $_GET[ ‘report’]);
I’ve also tried content type octet-stream, and application/ms-excel with the html w/class&id, but not with the other two permutations. Both tries to no avail.
The table that gets output can be in any of the formats specified above (text-tab, no parameter table, table with class/id tags). If the new version of excel finally solidified a format, could someone link a document that shows the right way to do it?
Thanks in advance.