Hi there

 

I have got a CF program which is working fine.  I'd just like to try and
improve the program.

 

Basically it has been developed to export the results of a query to an excel
spreadsheet (which it is doing).

 

I'm just wondering if there is a way so as to create the first row in the
spreadsheet which contains column names.

 

Here is the code which I have got:

 

<!--- Use cfsetting to block output of HTML outside of cfoutput tags --->

 

<cfsetting enablecfoutputonly="yes">

 

<!--- get medical delegate information --->

 

<cfquery name="qgetmedicaldelegates" datasource="#request.db_dsn#"
username="#request.db_login#" password="#request.db_pwd#">

SELECT                      *

FROM                         tbl_meddelregos

</cfquery>

 

<!--- set vars for special characters --->

<cfset TabChar = Chr(9)>

<cfset NewLine = Chr(13) & Chr(10)>

 

<!--- set content type to invoke Excel --->

 

<cfcontent type="application/msexcel">

 

<!--- Suggest default name for XLS file --->

 

<!--- use "Content-Disposition" in cfheader for Internet Explorer --->

 

<cfheader name="Content-Disposition" value="filename=medicaldelegates.xls">

 

<!--- Output data using cfloop & cfoutput --->

<cfloop query="qgetmedicaldelegates">

<cfoutput>

#ID##TabChar##Title##TabChar##FirstName##TabChar##LastName##TabChar##PrefNam
e##TabChar##BusName##TabChar##Address##TabChar##Suburb##TabChar##StateID##Ta
bChar##Postcode##TabChar##CountryCode##TabChar##Phone##TabChar##Fax##TabChar
##Mobile##TabChar##Email##NewLine#

</cfoutput>

</cfloop>

 

Thanks in advance

 

P




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7
The most significant release in over 10 years. Upgrade & see new features.
http://www.adobe.com/products/coldfusion?sdid=RVJR

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:272922
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to