java - Apache POI org.apache.poi.ss.formula.FormulaParseException -


i'm using apache poi , i'm facing issue when evaluating formula cell.

this code:

xssfcell cellvalue = sheet.getrow(6).getcell(2); if (cellvalue.getcelltype() == cellvalue.cell_type_formula) {    evaluator.evaluateformulacell(cellvalue); } 

the formula:

=c6/num_input , num_input = f36 

the issue:

org.apache.poi.ss.formula.formulaparseexception: cell reference expected after sheet name @ index 18. 

first, leave poi , check in excel if formula working fine. there no problem @ poi end. wrote sample code , it's working fine.

        xssfworkbook workbook = new xssfworkbook();         xssfsheet sheet = workbook.createsheet();         xssfformulaevaluator evaluator = new xssfformulaevaluator(workbook);         xssfcell cellvalue = sheet.createrow(0).createcell(0);         sheet.getrow(0).createcell(1).setcellvalue(2);         sheet.getrow(0).createcell(2).setcellvalue(5);         cellvalue.setcellformula("b1+c1");         if (cellvalue.getcelltype() == xssfcell.cell_type_formula) {            evaluator.evaluateformulacell(cellvalue);         }         system.out.println(cellvalue.getnumericcellvalue()); 

it evaluates 2 + 5 = 7 should.


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -