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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFContent tag…

Status
Not open for further replies.

DrStern

Programmer
Mar 28, 2003
53
US
Have any of you guys had any problem when using this tag (CFCONTENT) for displaying a query into an ms excel file? When my excel file is displayed, it includes a bunch of blank records. I already checked the query and it is throwing the right data.

This is the code that I’m using:

<cfcontent type=&quot;application/x-msexcel&quot;>

I use “x-msexcel” in order to make cfcontent tag work in XP….

Thank you guys for your help!!

Dr. Stern
 
the best thing to do is make it a comma delimited list and save the file as a .csv excel can read this and it is a comma delimited list if opened in Notepad. and use the cfsetting tag to enable cfoutput only.

<cfsetting enablecfoutputonly=&quot;yes&quot;>
<cfset newline = #chr(13)#&#chr(10)#>
<CFCONTENT type=&quot;application/msexcel&quot;>
<CFHEADER name=&quot;Content-Disposition&quot; value=&quot;attachment;filename=download#dateformat(now(), 'mmddyyyy')##timeformat(now(), 'HH-MM-SS')#.csv&quot;>
<cfoutput>
name,address,zip,phone number
<cfloop query = &quot;myQuery&quot;>
#myquery.name#,#myquery.address#,#myquery.zip#,#myquery.phone# #newline#
</cfloop>
<cfoutput>

thereptilian120x120.gif
 
Thanks for your response!
What is CFHEADER exactly for? I don't get it very well... :(

Thanks!!

Dr. Stern
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top