The following is code I use to dump results from a query to Excel. I have an app that
uses this logic right now with no issue. I am now running the same code pretty much
for another app on a different server.
Error Message(pop up from IE)
IE cannot download classexceldump.cfm. IE was not able to open this file form this
site. The request site was unavailble or not found. Try again later.
<CFHEADER NAME="content-disposition" VALUE="inline; filename=classroster.xls">
<cfcontent type="application/ms-excel">
<CFQUERY NAME="getYRInfo" datasource="#PrimaryDataSource#">
SELECT class_year
FROM alumni
WHERE username = '#session.user#'
</CFQUERY>
<CFQUERY NAME="getclass" datasource="#PrimaryDataSource#">
SELECT *
FROM alumni
WHERE class_year = '#getYRInfo.class_year#'
AND reunion_news = 'YES'
</CFQUERY>
<html>
<head>
<title>Class List</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<table width="100%" border="1" cellpadding="0" cellspacing="0" >
<tr align="center" bgcolor="CCCCCC">
<td colspan="3"><strong><font size="1" face=" Arial"
>Name</font></strong></td>
<td colspan="2"><strong><font size="1" face=" Arial"
>Address</font></strong></td>
<td><strong><font size="1" face=" Arial" >City</font></strong></td>
<td><strong><font size="1" face=" Arial"
>State</font></strong></td>
<td><strong><font size="1" face=" Arial" >Country</font></strong></td>
<td><strong><font size="1" face=" Arial"
>Zip</font></strong></td>
<td><strong><font size="1" face=" Arial" >Email
Address</font></strong></td>
<td><strong><font size="1" face=" Arial" >Phone
Number</font></strong></td>
</tr>
<cfoutput query="getclass">
<tr>
<td ><strong><font size="1" face=" Arial" >#fname#</font></strong></td>
<td ><strong><font size="1" face=" Arial"
>#lname#</font></strong></td>
<td><strong><font size="1" face=" Arial"
>#mname#</font></strong></td>
<td><strong><font size="1" face=" Arial"
>#addr1#</font></strong></td>
<td><strong><font size="1" face=" Arial"
>#addr2#</font></strong></td>
<td><strong><font size="1" face=" Arial" >#city#</font></strong></td>
<td><strong><font size="1" face=" Arial"
>#state#</font></strong></td>
<td><strong><font size="1" face=" Arial"
>#country#</font></strong></td>
<td><strong><font size="1" face=" Arial"
>#zip#</font></strong></td>
<td><strong><font size="1" face=" Arial" >#email#</font></strong></td>
<td><strong><font size="1" face=" Arial"
>#phone#</font></strong></td>
</tr>
</cfoutput>
</table>
</body>
</html>
Eric
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more
resources for the community.
http://www.fusionauthority.com/ads.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4