Hello,
I am trying to read an excel file via poi. Everything works fine except one thing. In my imported file there are two sheets. Some cells on the first page refers via a formular to cells on sheet 2, for example
. I only import sheet 0 and take the values from cells like this:
If Sheet2!U3 is empty, I always get "0" as value. After debugging I found out why:
WorkbookEvaluator.derefenceResult():
Is there any possibility to change this behaviour? What is about the method ISBLANK()? I could not find it anywhere? It also would be helpful, if I have access to the returned ValueEval (to do something like this:
). But as I have seen the ValueEval is wasted during the format()-operation and only the number value of NumberEval is evaluated.
I am trying to read an excel file via poi. Everything works fine except one thing. In my imported file there are two sheets. Some cells on the first page refers via a formular to cells on sheet 2, for example
Code:
=Sheet2!U3Code:
final ForumaleEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator();
final DataFormatter formatter = new DataFormatter();
final String value = formatter.format( cell, evaluator );WorkbookEvaluator.derefenceResult():
Code:
public static ValueEval dereferenceResult( ValueEval evaluationResult, int srcRowNum, int srcColNum )
{
...
if ( value == BlankEval.instance ) {
return NumberEval.ZERO;
// Formulas never evaluate to blank. If a formula appears to have evlautated to blank,
// the actual value is empty string. This can be verified with ISBLANK().
...
}Code:
if ( value == NumberEval.ZERO ) return null;