You can create an html table and output that is an excel file as follows:
<CFSETTING ENABLECFOUTPUTONLY="YES">
<cfif parameterexists(EmpName)>
<cfinclude template="qry_employees.cfm">
<cfif qry_employees.recordcount gt 0>
<cfset excelstring="<table
border=""1""><tr><td><b>First Name</b></td>">
<cfset excelstring=excelstring &"<td><b>Last
Name</b></td>">
<cfset excelstring=excelstring &"<td><b>Office
Phone</b></td>">
<cfset excelstring=excelstring &"<td><b>Mobile
Phone</b></td>">
<cfset excelstring=excelstring
&"<td><b>Pager</b></td></tr>">
<cfoutput query="qry_employees">
<cfset excelstring=excelstring
&"<tr><td>#empfirstname#</td><td>#emplastname#</td><td>#officep#</td><td>#ce
ll#</td><td>#pager#</td></tr>">
</cfoutput>
<cfset excelstring=excelstring &"</table>">
</cfif>
</cfif>
<CFHEADER NAME="Content-Disposition" VALUE="inline; filename=download.xls">
<cfcontent type="application/vnd.ms-excel">
<cfoutput>#excelstring#</cfoutput>
<CFSETTING ENABLECFOUTPUTONLY="No">
This output string that you have built will come across as an excel file.
The key is in the cfcontent tag and cfheader tag.
John Anderson
aloha-webdesign.com
-----Original Message-----
From: Janine Jakim [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 17, 2001 12:40 PM
To: CF-Talk
Subject: CF to excel
How flexible is the process of generating excel files?
I need to have an output that is dynamic for the columns and rows.
For example:
#student# #student# #student# #student#
#Skill# #grade# #grade# #grade# #grade#
#Skill# #grade# #grade# #grade# #grade#
#Skill# #grade# #grade# #grade# #grade#
Translating into:
JohnSmith JanSmith SamJones sandyJones
Reading C A A B
Math B A B A
English B B A C
My tables are normalized. There are many tables that make this info.
1. One reference table that lists all the skills.
2. One table that shows student information.
3. One table that lists the studentID/skillID/Grade (hooks the student info
with the skills reference table).
4. One reference table that lists the quarter and dates of the quarter so
only the current quarter prints out.
Is this possible?
What are the steps to making it so? Do I need to make the information into
an array(s) first?
I've read the how to from Ben's CF5 book and the tutorial from cfcomet.com-
but of course I want to make things more difficult.
Thanks in advance.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists