我试图评估.xlsx电子表格中的公式。我收到了“非法异常”错误。任何人都会指导我解决这个问题。
Cell cellDB_AcctNumber = row1.createCell(lastCell1);
cellDB_AcctNumber.setCellType(Cell.CELL_TYPE_NUMERIC);
cellDB_AcctNumber.setCellFormula("VLOOKUP($E"+k+",'C:/Vivekanandan/Compare/["+tempPath.getName()+"]\"VKT_AGENCY_BANK_INFO_TEMP\"'!$B$2:$E$"+lastrowDB+",2,FALSE)");
Cell value = evaluator.evaluateInCell(cellDB_AcctNumber);
错误:
java.lang.IllegalStateException: HSSF-style external references are not supported for XSSF
at org.apache.poi.xssf.usermodel.XSSFEvaluationWorkbook.getExternalSheet(XSSFEvaluationWorkbook.java:267)
at org.apache.poi.ss.formula.OperationEvaluationContext.createExternSheetRefEvaluator(OperationEvaluationContext.java:76)
at org.apache.poi.ss.formula.OperationEvaluationContext.getArea3DEval(OperationEvaluationContext.java:259)
at org.apache.poi.ss.formula.WorkbookEvaluator.getEvalForPtg(WorkbookEvaluator.java:611)
at org.apache.poi.ss.formula.WorkbookEvaluator.evaluateFormula(WorkbookEvaluator.java:493)
at org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(WorkbookEvaluator.java:287)
at org.apache.poi.ss.formula.WorkbookEvaluator.evaluate(WorkbookEvaluator.java:229)
at org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator.evaluateFormulaCellValue(XSSFFormulaEvaluator.java:268)
at org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator.evaluateInCell(XSSFFormulaEvaluator.java:183)
at com.sentry.comparison.compareexcel.CompareSpreadSheets.compareExcelResult(CompareSpreadSheets.java:93)
at com.sentry.comparison.main.FinalComparisonResult.main(FinalComparisonResult.java:45)