I've used the following code skeleton to successfully download XLS files (CSV, TXT, too) on systems with IE7 and Office 2007 installed (from IE, that is):
<!--- Tell the browser to expect an Excel file attachment. --->
<cfheader name="content-disposition" value="attachment; filename=filename.xls" />
<cfcontent type="application/excel" />
Try changing your type to applicaion/excel in cfcontent and add attachment; to your value attribute in cfheader.
Thanks, but that didn't work. If I put in "attachment;" and/or change the content type, I immediately get the "cannot access the file" error. It doesn't even get to the point where it prompts to open or save the file.
Can you post a little of the code related to creating the tab-delimited content? Are you grabbing the file from the server or creating the content dynamically to send to the user? It may well be an IE security thing but there should certainly be a way 'around' it.
Below is how it is being done. This worked perfectly for years. MS Office 2007 does complain that the file extension does not match the data format (it's a tab delimited text file but I'm pretending it's an Excel file so they'll be prompted to view it as a spreadsheet in Excel) but you just click open and it works fine. This issue with IE is new. Let me know if you have any more ideas.
<CFSETTING ENABLECFOUTPUTONLY="Yes" SHOWDEBUGOUTPUT="No">
<!--- variables used for separating cells with tabs, and for new rows --->
<CFSET newline=chr(13) & chr(10)>
<!--- tell browser it's an Excel file --->
<!--- tell Internet Explorer to open as Excel file --->
<CFHEADER NAME="Content-Disposition" VALUE="filename=myfile.xls">
<!--- get data --->
<CFQUERY NAME="getinfo" DATASOURCE="mydsn">
select fieldone, fieldtwo
<!--- output column headings --->
<CFOUTPUT><CFLOOP INDEX="q" LIST="fieldone,fieldtwo">#q##tabchar#</CFLOOP>#newline#</CFOUTPUT>
<!--- output database records --->
I ran a few tests in IE7 and IE8 this afternoon on both a Windows/IIS install and a Mac/Apache install. I was able to download the page from IE 7 and 8 without any errors. It would appear that there is a security setting of some sort (either installed with Office 2007
Using the code you posted as a base, statically typing in data where you had the query, I changed the CFCONTENT tag from this
<cfheader name="Content-Disposition" value="filename=myfile.xls">
<cfheader name="Content-Disposition" value="attachment;filename=myfile.xls">
For both browsers, I was also prompted to download the file (and it saved properly). Perhaps this might be worth a shot (altering the MIME Type away from an Office type) as a test.
Did you also try, essentially, removing all security from IE?
Try moving your query up in your code so that it runs prior to cfheader/cfcontent.
Having the same problem. I changed around the cfcontent type and when its just "excel" it returns all my data but on the browser screen. When I change it to msexcel it then gives me a file not found error.