Coldfusion Excel格式错误

时间:2014-03-31 14:49:56

标签: excel coldfusion apache-poi

我似乎无法在Coldfusion中进行任何格式化,尝试做任何事情都会导致此错误

NoSuchMethodError : org.apache.poi.ss.usermodel.Font.getCharSet()B

这是代码的问题区域,问题出在最后几行,其他一切正常。

<cfscript> 
            sheet = SpreadsheetNew("JEreport", "yes"); 
            SpreadsheetSetCellValue(sheet,"JE Report - Charge for Moves",1,1);
            SpreadsheetSetCellValue(sheet,"JE Report Charge for Moves for the Period From: " & toString(local.formatStartDate) & " To: " & toString(local.formatEndDate),3,1);
            SpreadsheetSetCellValue(sheet,"Report Date: " & toString(local.formatNow),4,1);
            SpreadsheetSetCellValue(sheet,"Created by: " & local.employee.empl_firstname & " " & local.employee.empl_lastname & " (" & session.user.getAlias() & ")",5,1);
            SpreadsheetAddRow(sheet,"Move ID,Move Type,Number of Movees (people),Number of Movees (items),Movees (people),Move Requested Date,Move Completed Date,Funding Category,Funding Type,Funding Source",7,1);

            for(i = 1; i <= local.numOfProjects; i++){
                SpreadsheetSetCellValue(sheet,local.arrayProjects[i].projectId,i+8,1);
                SpreadsheetSetCellValue(sheet,local.arrayProjects[i].move_type,i+8,2);
                SpreadsheetSetCellValue(sheet,local.arrayProjects[i].num_movers,i+8,3);
                SpreadsheetSetCellValue(sheet,local.arrayProjects[i].num_items,i+8,4);
                SpreadsheetSetCellValue(sheet,local.arrayProjects[i].movers,i+8,5);
                SpreadsheetSetCellValue(sheet,"Not Currently Available",i+8,6);
                SpreadsheetSetCellValue(sheet,local.arrayProjects[i].move_start_date,i+8,7);
                if(local.arrayProjects[i].move_type == "group"){
                    SpreadsheetSetCellValue(sheet,local.arrayProjects[i].move_funding_cat,i+8,8);
                }else{
                    SpreadsheetSetCellValue(sheet,"N/A",i+8,8);
                }
                SpreadsheetSetCellValue(sheet,local.arrayProjects[i].move_funding_type,i+8,9);
                SpreadsheetSetCellValue(sheet,local.arrayProjects[i].move_funding_source,i+8,10);
            }
            format1=structnew();
            format1.bold="true"; 
            theFile=GetDirectoryFromPath(arguments.tempDir) & "jeTemp.xlsx"; 
            format1.alignment="center"; 
            SpreadsheetFormatColumn(sheet,format1,5);
        </cfscript>

我不确定该怎么做。我明显错过了什么,但是什么?我使用的是Coldfusion 10,所以我不应该只需要做一些电子表格格式化吗?

1 个答案:

答案 0 :(得分:0)

根据文档,SpreadsheetFormatColumn需要4个参数(spreadsheetObj,format,row,column)。我只是在我的开发盒上尝试了它,并且有3个参数它引发了错误。尝试提供row和col参数,它应该可以工作。