Skip to main content
Participant
April 26, 2007
Question

<CFCONTENT TYPE="application/msExcel">

  • April 26, 2007
  • 1 reply
  • 358 views
I have a web page where the user can select different options to run a report by. One of the selection boxes allows the user to select multiple Project ID's. When they enter 2 Project ID's and run the report, everything works just fine. After viewing the report they can click on a "Download to Excel" button to view the same report within Excel. When they do this (for 2 Project ID's) it works just fine.

When the user types in 3 Project ID's and runs the report, the report displays just fine. The problem comes in when they click on the "Download to Excel" button. The same little pop-up box appears (as it did with 2 Project ID's) for the user to say whether to open the report or to save it. Either way, when the report is opened in Excel, you just see the raw html code (like what you would see if you did a "View Source" from the original web page).

I have this type logic working on several other pages just fine, but for some reason, this page won't work correctly. I'm using the following 2 lines of code in all of my pages:

<CFCONTENT TYPE="application/msExcel">
<CFHEADER NAME="content-disposition" VALUE="attachment; filename=project_budget.xls">

Any ideas??
This topic has been closed for replies.

1 reply

Inspiring
April 27, 2007
Hi,

Put the <cfheader> tag above of the <cfcontent> tag also put its type as "application/vnd.ms-excel" instead of "application/msExcel"

<cfheader name="Content-Disposition" value="atachment; filename=project_budget.xls">
<cfcontent type="application/vnd.ms-excel">
WrenRAuthor
Participant
April 27, 2007
Thanks for the suggestion. Unfortunately, it didn't change anything --- I receive the same results.
WrenRAuthor
Participant
April 27, 2007
I moved the CFHEADER and CFCONTENT statements closer to the beginning of the program and that corrected the problem.