Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using CFCONTENT and Exporting to Excel

Status
Not open for further replies.

szeiss

Programmer
Apr 5, 2000
137
US
I get the following message:

Internet Explorer cannot download...=HomeReportFAOYTDExpenditures from myserver

Internet Explorer was not able to open this internet site. The requested site is either unavailable or cannot be found. Please try again later.

Here is my code that I picked up off the web:

<!--- <cfsetting enablecfoutputonly=&quot;Yes&quot;>

<!--- get info --->
<cfquery name=&quot;ExportData&quot; datasource=&quot;&quot;>
SELECT FUND, AGENCY, ORG
FROM SPENDPLAN_RPT_TABLE
WHERE USERNAME = '#USERNAME#'
ORDER BY FUND, AGENCY, ORG
</cfquery>

<!--- set vars for special chars --->
<cfset TabChar = Chr(9)>
<cfset NewLine = Chr(13) & Chr(10)>
<!--- set content type to invoke Excel --->
<CFCONTENT TYPE=&quot;application/msexcel&quot;>

<!--- suggest default name for XLS file --->
<!--- use &quot;Content-Disposition&quot; in cfheader for
Internet Explorer --->
<cfheader name=&quot;Content-Disposition&quot; value=&quot;filename=FAOData.xls&quot;>
<!--- output data using cfloop & cfoutput --->
<cfloop query=&quot;ExportData&quot;>
<cfoutput>#FUND##TabChar##AGENCY#
#TabChar##ORGN##NewLine#</cfoutput>
</cfloop>

Does anyone know what's going on here? My server is a WIN2000 server with Excel loaded on the server. Also, CFCONTENT is enabled thru the administrator. I've been trying to get queries exported to Excel all morning and nothing seems to work. Any assistance is appreciated.

Thanks,
Sherry
 
Hi,

I just tried your code and it worked great and solved my problems...

So sorry don't no why it doesn't work for you. Im using IE 6.0, Win XP Pro, and CF MX and it just open in excel.
 
Did you ever find a solution to this? I get the same thing, but only with certain cfm templates, even though the cfcontent and cfheader are identical on the ones that work and the ones that don't work.
 
No, I didn't. I moved onto other things.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top