What I find is that poi sometime has difficulty parsing seemingly good formula
texts. When that happens, you will get what you got. Just retyping the
formula over and saving the file will make the problem go away. That's not a
solution, just showing the problem.
Jun Victorio <[EMAIL PROTECTED]> wrote:
st1\:*{behavior:url(#default#ieooui) } Hi there,
Im desperately need some help regarding cell formula. Im using jakarta
poi 2.5 final and poi-scratchpad-3.0-alpha1-20050704.jar for the formula
evalution.
First I need to get the cell formula in String. So I base on the user guide
here is my code:
HSSFCell cell = row.getCell(n);
If (cell.getCellType == HSSFCell.CELL_TYPE_FORMULA) {
String formula = cell.getCellFormula();
}
What Ive got is this value NO IDEA SHARED FORMULA EXP PTG
The formula is very simple: =A2*B2.
Second, I need to get the cell formula value. So from your documentation I
did the following
HSSFFormulaEvaluator evaluator = new HSSFFormulaEvaluator(sheet, wb);
HSSFRow row = sheet.getRow(n);
HSSFCell cell = row.getCell(n);
CellValue cellValue = evaluator.evaluate(cell);
After this I get a NullPointerException on the last line.
So I change it to:
CellValue cellValue = evaluator.evaluateInCell(cell);
Still get the NullPointerException
Ive check thru the debugger the evaluator is not null, nor the cell.
Ive even tried to use CellReference instead, but still the same problem.
Ive attached the excel file and the sample source code.
I really appreciate in advance your help.
Thanks and God Bless
Jun Victorio
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
---------------------------------
Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+
countries) for 2¢/min or less.