java使用poi读取excel时,因一些格式问题,执行excel函数错误
这个excel文件中内容比较多,其中有部分求和写成了这样:=SUM(,AR1902,AR1897,AR1882,AR1912,AR1889,AR1908)在excel中并...
这个excel文件中内容比较多,其中有部分求和写成了这样:=SUM(,AR1902,AR1897,AR1882,AR1912,AR1889,AR1908)
在excel中并没有提示什么错误,直接将求和的结果显示出来了,但是,我用poi执行到这些个单元格的时候,这会出现如下错误:
Exception in thread "main" java.lang.RuntimeException: Invalid ValueEval type passed for conversion: (class org.apache.poi.hssf.record.formula.eval.MissingArgEval)
at org.apache.poi.hssf.record.formula.functions.MultiOperandNumericFunction.collectValue(MultiOperandNumericFunction.java:194)
at org.apache.poi.hssf.record.formula.functions.MultiOperandNumericFunction.collectValues(MultiOperandNumericFunction.java:154)
at org.apache.poi.hssf.record.formula.functions.MultiOperandNumericFunction.getNumberArray(MultiOperandNumericFunction.java:127)
at org.apache.poi.hssf.record.formula.functions.MultiOperandNumericFunction.evaluate(MultiOperandNumericFunction.java:89)
at org.apache.poi.hssf.record.formula.eval.FunctionEval.evaluate(FunctionEval.java:247)
at org.apache.poi.ss.formula.WorkbookEvaluator.evaluateFormula(WorkbookEvaluator.java:374)
at org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(WorkbookEvaluator.java:257)
at org.apache.poi.ss.formula.WorkbookEvaluator.evaluate(WorkbookEvaluator.java:203)
at org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator.evaluateFormulaCellValue(XSSFFormulaEvaluator.java:252)
at org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator.evaluateFormulaCell(XSSFFormulaEvaluator.java:145)
at com.yuan.PoiExcel.read(PoiExcel.java:134)
at com.yuan.PoiExcel.<init>(PoiExcel.java:36)
at com.yuan.Main.main(Main.java:10)
在excel中手动将=SUM(,AR1902,AR1897,AR1882,AR1912,AR1889,AR1908)
改成=SUM(AR1902,AR1897,AR1882,AR1912,AR1889,AR1908)就不会出现这种错误
但是,excel中写成这样格式的不止这么一个单元格,全部手动改不现实,
所以想在程序里做点改动,求大神们帮帮忙!
谢谢! 展开
在excel中并没有提示什么错误,直接将求和的结果显示出来了,但是,我用poi执行到这些个单元格的时候,这会出现如下错误:
Exception in thread "main" java.lang.RuntimeException: Invalid ValueEval type passed for conversion: (class org.apache.poi.hssf.record.formula.eval.MissingArgEval)
at org.apache.poi.hssf.record.formula.functions.MultiOperandNumericFunction.collectValue(MultiOperandNumericFunction.java:194)
at org.apache.poi.hssf.record.formula.functions.MultiOperandNumericFunction.collectValues(MultiOperandNumericFunction.java:154)
at org.apache.poi.hssf.record.formula.functions.MultiOperandNumericFunction.getNumberArray(MultiOperandNumericFunction.java:127)
at org.apache.poi.hssf.record.formula.functions.MultiOperandNumericFunction.evaluate(MultiOperandNumericFunction.java:89)
at org.apache.poi.hssf.record.formula.eval.FunctionEval.evaluate(FunctionEval.java:247)
at org.apache.poi.ss.formula.WorkbookEvaluator.evaluateFormula(WorkbookEvaluator.java:374)
at org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(WorkbookEvaluator.java:257)
at org.apache.poi.ss.formula.WorkbookEvaluator.evaluate(WorkbookEvaluator.java:203)
at org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator.evaluateFormulaCellValue(XSSFFormulaEvaluator.java:252)
at org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator.evaluateFormulaCell(XSSFFormulaEvaluator.java:145)
at com.yuan.PoiExcel.read(PoiExcel.java:134)
at com.yuan.PoiExcel.<init>(PoiExcel.java:36)
at com.yuan.Main.main(Main.java:10)
在excel中手动将=SUM(,AR1902,AR1897,AR1882,AR1912,AR1889,AR1908)
改成=SUM(AR1902,AR1897,AR1882,AR1912,AR1889,AR1908)就不会出现这种错误
但是,excel中写成这样格式的不止这么一个单元格,全部手动改不现实,
所以想在程序里做点改动,求大神们帮帮忙!
谢谢! 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |