EDIT3:由于@Leigh的帮助下我已经缩小的问题在查询日期列。 使用原来的代码集和POI,页面崩溃时SpreadSheetAddRows()尝试添加包含日期样细胞非常大的查询。 我在这里做了一个错误报告: https://bugbase.adobe.com/index.cfm?event=bug&id=3432184 。
我有我加入,似乎当查询行的unweildly量(18583在这个例子中)错误而等试算表对象的查询。 确切的错误如下:
java.lang.ArrayIndexOutOfBoundsException: -32735
at java.util.ArrayList.get(ArrayList.java:324)
at org.apache.poi.hssf.model.WorkbookRecordList.get(WorkbookRecordList.j ava:50)
at org.apache.poi.hssf.model.Workbook.getExFormatAt(Workbook.java:787)
at org.apache.poi.hssf.usermodel.HSSFCell.getCellStyle(HSSFCell.java:901 )
at org.apache.poi.hssf.usermodel.HSSFSheet.autoSizeColumn(HSSFSheet.java :1727)
at coldfusion.excel.Excel.autoResize(Excel.java:1246)
at coldfusion.excel.Excel.autoResize(Excel.java:1240)
at coldfusion.excel.Excel.addRows(Excel.java:1214)
at coldfusion.runtime.CFPage.SpreadSheetAddRows(CFPage.java:7089) at coldfusion.runtime.CFPage.SpreadSheetAddRows(CFPage.java:7076)
下面是相关的代码:
<cfset xls = spreadsheetNew()>
<cfset spreadsheetAddRow(xls, arrayToList( qryTest.getMeta().getColumnLabels() ))>
<cfset SpreadsheetFormatRow(xls, {bold=true,fgcolor="brown",color="white"}, 1)>
<cfset SpreadsheetAddRows(xls, qryTest)>
<cfheader name="Content-Disposition" value="attachment; filename=#filename#">
<cfcontent variable="#spreadsheetReadBinary(xls)#" reset="yes" type="application/vnd.ms-excel">
编辑:我没有用以前cfspreadsheet成功,但它不会产生与头一个电子表格(它也有需要创建一个临时文件服务的缺点。)
EDIT2:继@Leigh建议我在CF9 / lib文件夹更新POI。 现在该错误已更改为以下几点:
<cfset SpreadsheetFormatRow(xls, {bold=true,fgcolor="brown",color="white"}, 1)>
提供了以下信息:org.apache.poi.hssf.util.HSSFColor.getIndexHash()Ljava / util的/哈希表;
错误代码:
java.lang.NoSuchMethodError:
org.apache.poi.hssf.util.HSSFColor.getIndexHash()Ljava/util/Hashtable;
at coldfusion.excel.Excel.getHSSFColor(Excel.java:2094)
at coldfusion.excel.Excel.findFont(Excel.java:2237)
at coldfusion.excel.Excel.getCellStyle(Excel.java:2318)
at coldfusion.excel.Excel.formatRow(Excel.java:2948)
at coldfusion.excel.Excel.formatRow(Excel.java:2963)
at coldfusion.excel.Excel.formatRow(Excel.java:2981)
at coldfusion.runtime.CFPage.SpreadSheetFormatRow(CFPage.java:7268)
并表示线路输出端口,它现在再次崩溃: <cfset SpreadsheetAddRows(xls, qryTest)>
错误代码:
java.lang.IllegalStateException: The maximum number of cell styles was exceeded. You can define up to 4000 styles in a .xls workbook
at org.apache.poi.hssf.usermodel.HSSFWorkbook.createCellStyle(HSSFWorkbook.java:1120)
at org.apache.poi.hssf.usermodel.HSSFWorkbook.createCellStyle(HSSFWorkbook.java:73)
at coldfusion.excel.Excel.addRow(Excel.java:1323)
at coldfusion.excel.Excel.addRows(Excel.java:1203)
at coldfusion.runtime.CFPage.SpreadSheetAddRows(CFPage.java:7089)
at coldfusion.runtime.CFPage.SpreadSheetAddRows(CFPage.java:7076)