Hi Cassidy,

Here's a good COM free alternative:

1. Start with your finished product i.e. the finished excel document you're
trying to generate w/ CF.  With Office 97 and higher you can save Excel
documents as .html files using File -> Save As -> File Type = .htm

2. From there it's just a matter of generating that saved file:

generateexceldocument.cfm ->

<cfset attributes.filename = "test.xls">

<cfsavecontent variable="attributes.generatedpage">     
<cfoutput>
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40";>

<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=ProgId content=Excel.Sheet>
<meta name=Generator content="Microsoft Excel 9">
<link rel=File-List href="./headcountest_files/filelist.xml">
<link rel=Edit-Time-Data href="./headcountest_files/editdata.mso">
<link rel=OLE-Object-Data href="./headcountest_files/oledata.mso">
</head>

<body link=blue vlink=purple>

<table x:str border=0 cellpadding=0 cellspacing=0 width=858
style='border-collapse:
 collapse;table-layout:fixed;width:644pt'>
 <col width=256
style='mso-width-source:userset;mso-width-alt:9362;width:192pt'>
 <col width=160
style='mso-width-source:userset;mso-width-alt:5851;width:120pt'>
 <col width=122
style='mso-width-source:userset;mso-width-alt:4461;width:92pt'>
 <col width=256
style='mso-width-source:userset;mso-width-alt:9362;width:192pt'>
 <col width=64 style='width:48pt'>
 <tr height=23 style='mso-height-source:userset;height:17.25pt'>
  <td colspan=4 rowspan=2 height=40 class=xl29 width=794
style='height:30.0pt;
  width:596pt'>Hello World!!</td>
  <td width=64 style='width:48pt'></td>
 </tr>
</table>
</body>
</html>
</cfoutput>
</cfsavecontent>

<cffile action = "write" 
                file = "#request.reportPath##attributes.filename#" 
                output = "attributes.generatedpage#">
<!--- make sure to save this as .xls file!! --->
<-              

3.  Then redirecting to it:

<cflocation url="#request.reportWWW##attributes.filename#">             


This is a nice COM free approach.  I like it because you can make the Excel
sheet as complicated as you want i.e. use multipe sheets, formulas, special
formatting, page headers and footers, etc.,

HTH


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Get the mailserver that powers this list at 
http://www.coolfusion.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to