解析带有 java 点的公式不起作用

Parsing a formula with java poi doen't work

我需要用一些数据完成 excel。但是 sheet 中的一个单元格是一个公式,所以我正在使用 poi 库提供的解析公式,但我想使用的公式有一些问题:

=IF((E9*1,5+F9+G9*2/3) = 0;"";E9*1,5+F9+G9*2/3)

PS : 所有单元格都在不同的列表中

代码如下:

"IF(("+cellule_cm.get(ligne_excel)+"*1,5+"+cellule_td.get(ligne_excel)+"+"+
cellule_tp.get(ligne_excel)+"*2/3)=0;\"\";"+cellule_cm.get(ligne_excel)+"*1,5+"+cellule_td.get(ligne_excel)+"+"+cellule_tp.get(ligne_excel)+"*2/3)";

ligne_excel 是我要修改的行的索引 cellule_cmcellule_tdcellule_tp 是我的单元格列表

当我 运行 它抛出异常 :

Parse error near char 23 ';' in specified formula 'IF((E9*1,5+F9+G9*2/3)=0;"";E9*1,5+F9+G9*2/3)'. Expected ',' or ')'

我不明白为什么我无法解析 你能帮帮我吗?

不确定,但你是不是漏掉了一个“=”?

  • IF((E9*1,5+F9+G9*2/3)=0;"";E9*1,5+F9+G9*2/3)
  • IF((E9*1,5+F9+G9*2/3)==0;"";E9*1,5+F9+G9*2/3)

根据 Apache POI-documentation POI 仅支持逗号作为参数的分隔符:

部分“基础知识

"Also note that only commas may be used to separate arguments, as per the Excel English style, alternate delimeters used in other localizations are not supported."