Jake - 

I'm going to make 2 assumptions here:

1) You are making some modular code that will allow you to output a database query 
into an 
excel spreadsheet, rather than a 'once off' display solution that displays a 
particular query.

2) In your sample code there is actually a part that grabs the column headers of the 
query 
and displays them in a row above the query.

I do something similar in my reporting module i have for some applications.

My answer to the problem is small xml config files that contain all sorts of 
information.

Part of it looks like this:
<?xml version="1.0"?>
<report>
        <name>My Report For You</name>          

        <columnDisplay>
                <column name="ID">ID For This</column>
                <column name="UserName">Name for THING</column>
                <column name="q1">Question 1</column>
        </columnDisplay>
</report>

Within my display, when I loop around the list of column names, I do an XPath server 
on the 
[EMAIL PROTECTED]'#columnName#'] to get the name I've described out, and then displays 
it.

Hope that helps in what you are looking for.
(Unless what you are asking is much simpler?)

Mark
------------------------------------------------------------------
[EMAIL PROTECTED]
ICQ: 3094740
Safe From Bees
[ www.safefrombees.com ]


Quoting Jake A <[EMAIL PROTECTED]>:

> 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
> 
> 
> 

---
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