I am new to the jexcel api and have not yet successfully added a formula.
Whenever I try to compile a formula I get the compile error:
Exception in thread "main" java.util.EmptyStackException
at java.util.Stack.peek(Stack.java:102)
at java.util.Stack.pop(Stack.java:84)
at jxl.biff.formula.BinaryOperator.getOperands(BinaryOperator.java:61)
at jxl.biff.formula.StringFormulaParser.parseCurrent(StringFormulaParser.java:240)
at jxl.biff.formula.StringFormulaParser.parse(StringFormulaParser.java:113)
at jxl.biff.formula.FormulaParser.parse(FormulaParser.java:161)
at jxl.write.biff.FormulaRecord.initialize(FormulaRecord.java:160)
at jxl.write.biff.FormulaRecord.setCellDetails(FormulaRecord.java:243)
at jxl.write.biff.WritableSheetImpl.addCell(WritableSheetImpl.java:1199)
With addCell being called from
Formula formula;
formula = new Formula(column, row, string, arial);
sheet.addCell(formula);
Please let me know if I’m making some obvious mistake and what steps I can take in order to properly add a formula to my spreadsheet.
so the error you got is similar to NullPointerException, with the difference, that your stack is empty, so you can’t peek anything from it.
That can suggest that there’s something wrong with your
stringHere is a tutorial http://www.java-tips.org/other-api-tips/jexcel/how-to-create-an-excel-file.html talking also about creating Formulas.
And here is anouther one: http://r4r.co.in/java/apis/jexcel/basic/example/jexcel_basic_examples.php?id=774&option=Jexcel%20Example