Apache poi setformula does't work With SE

2019-07-13 04:06发布

问题:

I'm trying ti set a formula in a XSSFCell With POI.

Cell.setFormula("SE(D87=0; ""; D80/D87)");

The error is:

 Name 'SE' is completely unknown in the current workbook. 

Someone knows why? Thanks!

回答1:

It looks like you are attempting to create an IF formula. I found this page about Excel formula translations into different languages, where I found that the English formula name IF translates to SE in a few languages.

I don't believe that Apache POI supports formula names in names other than English. Try the English name. You may or may not need to replace the semicolons with commas; I'm not sure if Apache POI takes that into account.

cell.setCellFormula("IF(D87=0, \"\", D80/D87)");