headers-excel file-bad data



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: Running Excel Addin from VBA in Access....HELP!!
    ... You initially build a macro in Excel to do what you want, ... imbeds it in an Excel file of your choosing, then runs it as a macro. ... code that creates an Excel file, ... Dim objUniqueTeams As Object ...
    (microsoft.public.access.modulesdaovba)
  • Re: Real Workaround for Excel Link Bug in 2007?
    ... you'd need the Excel file in the local directory. ... Or did you mean local HDD vs "the same directory as the PPT itself"? ...
    (microsoft.public.powerpoint)
  • Re: Import same Excel ranges from many workbooks
    ... Import Data from that EXCEL File via TransferSpreadsheet" in your suggested ... Dim strTable As String, strBrowseMsg As String ... accept the named ranges from those Excel workbooks without errors. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Importing data from Excel 2003 to Access 2003
    ... On which code step does the debugger highlight for the "object/class" error? ... Dim strPathFile As String, strFile As String, strPath As String ... ' Change this next line to True if the first row in EXCEL worksheet ... in the rest) of an Excel file and puts the data in an Access table. ...
    (microsoft.public.access.externaldata)
  • RE: Issue with UNC Path (I think). Trying to build Dynamic Report
    ... Table and then suck in all the data from my Excel sheet on the network drive. ... easy to find the UNC path for a drive litter. ... Function UNCDrive(strUNCName As String) As String ... I am trying to Link to an Excel file on a network drive and build a Report ...
    (microsoft.public.access.formscoding)