我见过this后,但看起来确实是一个解决方案。无论如何,我正在使用ColdFusion 10来生成Excel电子表格。但是,当我使用SpreadsheetFormatRow()并传入要格式化的行时,它只会执行大约3次,然后突然停止。下面是一个例子...SpreadsheetFormatRow突然停止工作
ColdFusion代码
<cfscript>
rowCount = 1;
headingRows = 4;
// Create instance of new Spreadsheet
excelSheet = SpreadsheetNew("ReportName",false);
// HEADING (IMAGE) ROW FORMAT
formatHeadingRow = StructNew();
formatHeadingRow.fgcolor="blue";
// Add rows to fill the header area (must add as many as we are spanning with the above image)
for (x=0;x<headingRows;x++) {
SpreadsheetAddRow(excelSheet,"TEST,TEST,TEST,TEST,TEST,TEST,TEST,TEST,TEST,TEST,TEST,TEST");
SpreadsheetFormatRow(excelSheet,formatHeadingRow,rowCount);
rowCount++;
}
</cfscript>
<!--- stream it to the browser --->
<cfheader name="Content-Disposition" value="inline; filename=reportName.xls">
<cfcontent type="application/vnd.ms-excel" variable="#SpreadSheetReadBinary(excelSheet)#">
,这里是生成的Excel工作表
的为什么格式化十大之后停止截图行数和单元格数? 如果我切换到使用XML格式
excelSheet = SpreadsheetNew("ReportName",true);
它工作正常。不过,我为我的颜色使用自定义调色板,所以我不认为切换到XLSX格式对我来说很有用。当我尝试然后致电
palette = excelSheet.getWorkbook().getCustomPalette();
我收到一个错误,指出getCustomPalette()方法未定义。
coldfusion.runtime.java.MethodSelectionException: The getcustompalette method was not found
任何人都可以帮我解决这个问题吗?谢谢!!!
甚至更好,因为它的工作原理与XML格式,任何人都可以显示例如如何使用自定义调色板与XLSX(XML格式)
通过trycf只是想你的代码,它工作正常的CF10 http://trycf.com/gist/ce1e66bed5fe5d1bc40f8abd79f8fc72/acf?theme=monokai –
@JohnWhish我只是用你的trycf.com链接尝试,它给了我同样的结果。几行后格式破碎,最后几个单元格保持白色而不是蓝色。什么版本的Excel?我的Excel 2016与Office 365 – Phil