> On Tuesday 14 Aug 2007, [EMAIL PROTECTED] wrote:
> > I can create an excel document in the browser using POI
>
> You mean you can create on server side and send it to the browser ?
>
> > out how to attach that document to an email and send it using cfmail.
>
>
> cffile, at a guess.
>
> > Can someone tell me what I need to do to make this work or is it
> not
> > possible?
>
> What's your current code look like ?
>
> --
> Tom Chiverton
> Helping to challengingly customize dynamic e-tailers
> on: http://thefalken.livejournal.com
>
> ****************************************************
>
> This email is sent for and on behalf of Halliwells LLP.
>
> Halliwells LLP is a limited liability partnership registered in
> England and Wales under registered number OC307980 whose registered
> office address is at St James's Court Brown Street Manchester M2 2JF.
> A list of members is available for inspection at the registered office.
> Any reference to a partner in relation to Halliwells LLP means a
> member of Halliwells LLP. Regulated by the Law Society.
>
> CONFIDENTIALITY
>
> This email is intended only for the use of the addressee named above
> and may be confidential or legally privileged. If you are not the
> addressee you must not read it and must not use any information
> contained in nor copy it nor inform any person other than Halliwells
> LLP or the addressee of its existence or contents. If you have
> received this email in error please delete it and notify Halliwells
> LLP IT Department on 0870 365 8008.
>
> For more information about Halliwells LLP visit www.halliwells.com.
This is the current code I am testing with. It was pulled from somewhere on
Google yesterday afternoon.
<cfscript>
context = getPageContext();
context.setFlushOutput(false);
response = context.getResponse().getResponse();
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition","attachment; filename=unknown.xls");
out = response.getOutputStream();
</cfscript>
<cfset wb =
createObject("java","org.apache.poi.hssf.usermodel.HSSFWorkbook").init()/>
<cfset format = wb.createDataFormat()/>
<cfset sheet = wb.createSheet("new sheet")/>
<cfset cellStyle = wb.createCellStyle()/>
<!--- Take formats from:
http://jakarta.apache.org/poi/apidocs/org/apache/poi/hssf/usermodel/HSSFDataFormat.html
--->
<cfset
cellStyle.setDataFormat(createObject("java","org.apache.poi.hssf.usermodel.HSSFDataFormat").getBuiltinFormat("0.00"))/>
<cfloop index = "LoopCount" from = "1" to = "5">
<!--- Create a row and put some cells in it. Rows are 0 based. --->
<cfset row = sheet.createRow(javacast("int",LoopCount))/>
<!--- Create a cell and put a value in it --->
<cfset cell = row.createCell(0)/>
<cfset cell.setCellType( 0)/>
<cfset cell.setCellValue(javacast("int",1))/>
<!--- Or do it on one line. --->
<cfset cell2 = row.createCell(1)/>
<cfset cell2.setCellStyle(cellStyle)/>
<cfset cell2.setCellValue(javacast("double","1.223452345342"))/>
<cfset row.createCell(2).setCellValue("This is a string")/>
<cfset row.createCell(3).setCellValue(true)/>
</cfloop>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade to ColdFusion 8 and integrate with Adobe Flex
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:286152
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4