Suggest you build the format/layout you want in Excel, set your paper sizes,
print areas, cell formats etc, and then do a "Save as webpage" and check out
the resulting HTML. With Excel 2000 and later you get some nice little XML
blocks where you can control most aspects of the spreadsheet.

Cheers.

Scott.
-----Original Message-----
From: Jake A [mailto:[EMAIL PROTECTED]
Sent: Monday, 19 January 2004 11:39 AM
To: CFAussie Mailing List
Subject: [cfaussie] Cf to Excel - Change column names


Hi all,

I'm creating an Excel document from a database table which is working
fine,
although i was hoping to be able to dynamically change the column titles.

Here is the code:

<!---query to output all results in a excel spreadsheet--->
<cfquery name="get_results" datasource="DSN">
SELECT *
FROM answers
WHERE id = 1
</cfquery>

<html>
<head>
<title>Excel Output</title>
 
<cfheader name="Content-Disposition" value="attachment; Filename=Name.xls">

<CFCONTENT TYPE="application/vnd.ms-excel" RESET="Yes">
</head>

<body>

<cfoutput query="get_results">
<table border="1">
<tr>
<td>#id#</td<td>#Username#</td<td>#q1#</td>
</tr>
</table>
</cfoutput>
</html>

An example or the output on the excel doc:

A          B            C
-----------------------------
1       nametest     q1answer


The field values are being updated by the database. I was hoping to change
the field titles (a,b,c).

Any help or suggestions are appreciated!

Thanks 

Jake 

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
[EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

IMPORTANT NOTICE: This e-mail and any attachment to it are intended only to be read or 
used by the named addressee. It is confidential and may contain legally privileged 
information. No confidentiality or privilege is waived or lost by any mistaken 
transmission to you. The RTA is not responsible for any unauthorised alterations to 
this e-mail or attachment to it. Views expressed in this message are those of the 
individual sender, and are not necessarily the views of the RTA. If you receive this 
e-mail in error, please immediately delete it from your system and notify the sender. 
You must not disclose, copy or use any part of this e-mail if you are not the intended 
recipient.

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

Reply via email to