EXAMPLE 1:
<cfobject component="cfHSSF" name="exc" />
<cfset wb = exc.readBook("c:\workbook1.xls")>
<cfset sh = exc.readSheet(workbook=wb, sheetname="sh2")>
<cfset cv = exc.getCellValue(sh, 0, 0)>
<cfdump var="#cv#">
EXAMPLE 2:
<cfobject component="cfHSSF" name="exc" />
<cfset theArr = ArrayNew(2)>
<cfset theArr = exc.worksheet2array(BOOKNAME="d:\Reports.xls", sheetName="Sheet1")>
<cfdump var="#theArr#">
EXAMPLE 3:
<cfobject component="cfHSSF" name="exc" />
<cfquery name="getA" datasource="#request.dsn#">
Select *
From states
</cfquery>
<cfset exc.easyQuery2Excel(BOOKNAME="c:\wb.xls", sheetName="sh", titles=getA.columnList, data=getA)>
EXAMPLE 4:
<cfobject component="cfHSSF" name="exc" />
<cfset wb1 = exc.init()>
<cfset sh1 = exc.createSheet(wb1, "sh2")>
<cfset cell1 = exc.setCellValue(sh1, 3, 4, "asd")>
<cfset exc.setCellValue(sh1, 0, 0, "1")>
<cfset exc.setCellValue(sh1, 0, 1, "3")>
<cfset exc.setCellDataFormat(workbook=wb1, sheet=sh1, rownum=2, cellnum=2, format="m/d/yy h:mm", val=Now())>
<cfset exc.setRowHeight(sh1, 0, 1000)>
<cfset exc.setCellWidth(sh1, 0, 5000)>
<cfset exc.setCellAlign(workbook=wb1, cell=cell1, align="right", wrap="true")>
<cfset exc.setCellFormula(sheet=sh1, frml="A1+B1", rownum=1, cellnum=1)>
<cfset exc.setCellBorder(workbook=wb1, cell=cell1, border="Thin", color="red")>
<cfset exc.setCellPattern(workbook=wb1, cell=cell1, pattern="BIG_SPOTS", color="red")>
<cfset exc.createDateCell(wb1, sh1, 1, 0, "h:mm")>
<cfset exc.setCellFontStyle(workbook=wb1, cell=cell1, bold="false", underline="doubLE_ACCOUNTING")>
<cfset region = exc.mergeRegion(sh1, 4, 4, 10, 11)>
<cfset exc.setCellPattern(workbook=wb1, cell=exc.setCellValue(sh1, 4, 4, "asd"), pattern="BIG_SPOTS", color="red")>
<cfset exc.setPageNum(sh1)>
<cfset exc.fitSheet(sh1)>
<cfset exc.setFooters(sheet=sh1, lfooter="left", cfooter="center", rfooter="right", lfooterfont="Verdana", lfooterfontstyle="italic", rfooterfontsize=30)>
<cfset fo = exc.createBook(wb1, "C:\workbook1.xls")>
<cfset exc.close(fo)>
Hope it helps
I 've tried ur examples , it works
thank u
i don't think there is a bookto2array function, but maybe you mean worksheet2array instead. Anyway, before even trying to rename or delete the file be sure to "close" it or else it is supposed to be "in use".