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 formula to cells on sheet 2, for example =Sheet2!U3. I only import sheet 0 and take the values from cells like this:
final ForumaleEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator(); final DataFormatter formatter = new DataFormatter(); final String value = formatter.format( cell, evaluator ); If Sheet2!U3 is empty, I always get "0" as value. After debugging I found out why: WorkbookEvaluator.derefenceResult(): 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(). ... } Is there any possibility to change this behavior? 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: if ( value == NumberEval.ZERO ) return null; ). But as I have seen the ValueEval is wasted during the format()-operation and only the number value of NumberEval is evaluated. Kind regards, Philipp Bönisch Software Engineer Rail & Transit Solutions CSC Deutschland GmbH p: +49 351 47771 50 | f: +49 351 47771 11 | pboeni...@csc.com<mailto:pboeni...@csc.com> | www.csc.com/de | 01069 Dresden Germany | Bergstr. 2 CSC Deutschland GmbH * Registered Office: Abraham-Lincoln-Park 1, 65189 Wiesbaden, Germany * Board of Directors: Claus Schünemann (Chairman), Josef Ranner * Chairman of the Supervisory Board: William L. Deckelman * Registered in Germany: HRB 11307 * CSC * This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. * NOTE: Regardless of content, this e-mail shall not operate to bind CSC to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose.