Re: headers-excel file-bad data



Looks like I have an empty space somewhere...this code is called down in a
class and if I just cut this out and copy into it's own file and call that
file from the browser, it works fine. It is someone getting garbled down in
the class.

On 7/31/07, blackwater dev <blackwaterdev@xxxxxxxxx> wrote:

Hello,

I have an excel file that I am generating. If I copy over the generated
file and then open it in excel, it works fine, if I try to let the user
download it using the headers below, when I then open it excel complains
that it is an unrecognizable format and the info is garbled...any ideas???

Thanks!

header('Pragma: public');
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); //
Date in the past
header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate'); //
HTTP/1.1
header('Cache-Control: pre-check=0, post-check=0, max-age=0'); //
HTTP/1.1
header ("Pragma: no-cache");
header("Expires: 0");
header('Content-Transfer-Encoding: none');
header('Content-Type: application/vnd.ms-excel;'); //
This should work for IE & Opera
header("Content-type: application/x-msexcel"); //
This should work for the rest
header('Content-Disposition: attachment; filename="myfile.xls"');
readfile("/tmp/myfile.xls");






Relevant Pages

  • Re: Removing Blank Cells
    ... Excel is actually using. ... way out into empty space then you would be wasting ... If you need to make another cell your last cell to drop ... If you have 3 sheets and use only 2 sheets you could drop that ...
    (microsoft.public.excel.misc)
  • Re: Why cant I see my cell selections?
    ... Try changing the Windows Appearance (right click empty space on desktop and ... Microsoft Excel MVP ... Is there a way to adjust the color for selecting cells? ...
    (microsoft.public.excel.misc)
  • Re: Searching for text
    ... Rick (MVP - Excel) ...
    (microsoft.public.excel.worksheet.functions)
  • RE: MS Excel Remote Code Execution POC Exploit
    ... Excel complains that the excel sheet is corrupt ...
    (Bugtraq)
  • Re: errors opening excel files - file path broken up
    ... Tools|Options|General|Ignore other applications (uncheck it) ... Windows Start Button|Run ... excel /unregserver ... Excel complains of not being able to find the file, ...
    (microsoft.public.excel)