Is this what you want?
<cfquery name="q1" datasource="myDatasource">
SELECT * FROM myTbl
ORDER BY myCol1,myCol2
</cfquery>
<CFHEADER NAME="Content-Disposition" VALUE="inline; filename=foo.xls">
<cfcontent type="application/msexcel">
<table border=1>
<tr style="background-color:#b0ccb0">
<cfloop list="#q1.columnList#" index="i">
<cfoutput>
<td style="font-weight:bold;">#i#</td>
</cfoutput>
</cfloop>
</tr>
<cfoutput query="q1">
<tr>
<cfloop list="#q1.columnList#" index="i">
<td>#Evaluate("q1.#i#")#</td>
</cfloop>
</tr>
</cfoutput>
</table>
----- Original Message -----
From: "Ron Eis" <[EMAIL PROTECTED]>
To: "CF-Talk" <[email protected]>
Sent: Friday, January 14, 2005 7:27 PM
Subject: RE: Creating .xls files with column headers
> Thanks for all the tips.
>
> The <CFSILENT> did output all the data on the same line of the .xls
> file.
>
> After a lot of trial and error, the only way I got it to remove the
> extra lines while not outputting all the data on one line is by taking
> out all the spaces within (and between) the <cfcontent> and <cfoutput>
> tags EXCEPT for leaving one space before the </cfoutput> tag.
>
> Now only if I can find a way to include or write the column headers at
> the top of the top spreadsheet.
>
> Any ideas?
>
> (And thanks Bryan for the "To # or not to #" reminder! I'm embarrassed
> that I included those in my code.)
>
> -----Original Message-----
> From: Jared Rypka-Hauer - CMG, LLC [mailto:[EMAIL PROTECTED]
> Sent: Friday, January 14, 2005 5:20 PM
> To: CF-Talk
> Subject: Re: Creating .xls files with column headers
>
> Adrian,
>
> I just read your response in a little deeper detail and noticed that you
> have:
> <cfoutput>#content#</cfoutput>
>
> That's going to send Excel a string that looks like this:
> contentcontentcontentcontentcontent
>
> That's not going to work either... the line breaks in the code need to
> be exactly as you want Excel to receive them. Under your example
> they'll all end up on one line.
>
> Laterz,
> J
>
> --
> Continuum Media Group LLC
> Burnsville, MN 55337
> http://www.web-relevant.com
> http://cfobjective.blogspot.com
>
>> > Try:
>> >
>> > <cfcontent type="application/msexcel"><cfoutput query="get
>> > Data">#Name_First##TAB##Name_Last##TAB##Group_Company#</cfoutput>
>> >
>> > Also, would setting the reset attribute of cfcontent help any?
>> >
>> > Ade
>>
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190576
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54