Thanks for the tips. I will aim for creating a local file.


>http://www.bennadel.com/blog/469-Creating-Microsoft-Excel-Files-Using-ColdFu
>sion-And-POI.htm
>
>
>
>
>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/HSSFData
>Format.html --->
><cfset
>cellStyle.setDataFormat(createObject("java","org.apache.poi.hssf.usermodel.H
>SSFDataFormat").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> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Enterprise web applications, build robust, secure 
scalable apps today - Try it now ColdFusion Today
ColdFusion 8 beta - Build next generation apps

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

Reply via email to