且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Apache POI:计算公式时发生异常

更新时间:2022-04-10 23:10:06

启用poi日志后,我发现

After enabling the poi logs i found that the cell on which

=CONCATENATE("#DFLT=",COUNTIF(C5:C390,"=DEFAULTERS"),"; #NP=",COUNTIF(C5:C390,"=NOT PAID"),"; #PCsh=",COUNTIF(C5:C390,"=Paid Cash"),"; #PChk=",COUNTIF(C5:C390,"=Paid Cheque"),"; #PNeft=",COUNTIF(C5:C390,"=Paid Neft"))

是依赖的,也是出色的公式.

was dependent, were also excel formula.

=CONCATENATE(" {",HZ5," - ",IA5,"}, ","{",IB5,,"}")

此公式有一个额外的逗号(,),在解析该公式时,并在评估此Missing Argument的结果时,它导致IllegalArgumentException导致MissingArgument.

This formula had an extra comma(,), Which was causing an MissingArgument while parsing the formula, and while evaluating this Missing Argument results in IllegalArgumentException.

POI日志显示:

10-30 16:56:18.377: I/System.out(26511): [POI.FormulaEval]I       * ptg 7: org.apache.poi.ss.formula.ptg.MissingArgPtg [ ]
10-30 16:56:18.377: I/System.out(26511): [POI.FormulaEval]I         = org.apache.poi.ss.formula.eval.MissingArgEval@42be7f58