Re: Create an Excel Spreadsheet

2007-03-19 Thread Dana Kowalski
If you use an html table instead and use TH, the TH will transfer over as 
column headers in Excel.

~|
Deploy Web Applications Quickly across the enterprise with ColdFusion MX7  
Flex 2
Free Trial 
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJU

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


RE: Create an Excel Spreadsheet

2007-03-19 Thread Robert Rawlins - Think Blue
I'm not sure how flexible it is, but I know in the past when working with
Excel sheets I always worked with the XML model as it allowed quite a nice
set of features. Without the funny hacks of changing HTML into excel files.

Rob

-Original Message-
From: Dana Kowalski [mailto:[EMAIL PROTECTED] 
Sent: 19 March 2007 14:58
To: CF-Talk
Subject: Re: Create an Excel Spreadsheet

If you use an html table instead and use TH, the TH will transfer over as
column headers in Excel.



~|
Create robust enterprise, web RIAs.
Upgrade  integrate Adobe Coldfusion MX7 with Flex 2
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP

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


Re: Create an Excel Spreadsheet

2007-03-18 Thread Robertson-Ravo, Neil (RX)
Have a look at using Apache POI, which is in CF7 already. This will create
Excel sheets using Java which is far more efficient than using HTML to mimic
a sheet.

You could also look at using DTS if you are on SQL Server to export the
results to Excel.






This e-mail is from Reed Exhibitions (Gateway House, 28 The Quadrant,
Richmond, Surrey, TW9 1DN, United Kingdom), a division of Reed Business,
Registered in England, Number 678540.  It contains information which is
confidential and may also be privileged.  It is for the exclusive use of the
intended recipient(s).  If you are not the intended recipient(s) please note
that any form of distribution, copying or use of this communication or the
information in it is strictly prohibited and may be unlawful.  If you have
received this communication in error please return it to the sender or call
our switchboard on +44 (0) 20 89107910.  The opinions expressed within this
communication are not necessarily those expressed by Reed Exhibitions. 
Visit our website at http://www.reedexpo.com

-Original Message-
From: Pete
To: CF-Talk
Sent: Sun Mar 18 03:36:28 2007
Subject: Create an Excel Spreadsheet

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:272925
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Create an Excel Spreadsheet

2007-03-17 Thread Pete
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


Re: Create an Excel Spreadsheet

2007-03-17 Thread Dinner
On 3/17/07, Pete wrote:


Right before the loop, do this:

 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

Which should work.

If you can use createObject, there's also some stuff over on google code

http://code.google.com/p/cfjexcel/

basically just a couple of cfcs that use jExcelApi for import/export of xls.

There's a very basic row level formula embedder in query2xls.cfc.

Not sure if the zip has the latest source, so might wanna download the
two cfcs from here:

http://cfjexcel.googlecode.com/svn/trunk/

You could loop through the column names too, somelhing tike:

cfset var xlsFile = 
cfloop list=#qgetmedicaldelegates.columnlist# index=fieldNam
  cfset xlsFile = listAppend(xlsFile,fieldNam,tabChar)
/cfloop

Then whack off the last tabChar, add a newLine, and viola!
One more loop using the query values, something like

cfloop query=qgetmedicaldelegates
   cfloop list=#qgetmedicaldelegates.columnlist# index=fieldNam
cfset xlsFile =
listAppend(xlsFile,qgetmedicaldelegates[fieldNam][currentRow],tabChar)
   /cfloop
/cfloop

Again, whack off the last tabChar, and that would
do it (assuming tabChar would work as a list delim).

Someone had a nifty solution to the whole how do I get rid of the
last list thingie, but I don't remember it off hand.  :-/

Have Fun!

 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


~|
Create Web Applications With ColdFusion MX7  Flex 2. 
Build powerful, scalable RIAs. Free Trial
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS 

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