Example usage for org.apache.poi.ss.formula.eval RefEval getNumberOfSheets

List of usage examples for org.apache.poi.ss.formula.eval RefEval getNumberOfSheets

Introduction

In this page you can find the example usage for org.apache.poi.ss.formula.eval RefEval getNumberOfSheets.

Prototype

int getNumberOfSheets();

Source Link

Document

returns the number of sheets this applies to

Usage

From source file:nl.eur.ese.spreadsheettest.DStarRunner.java

License:Apache License

/**
 * Resolve reference(-chains) until we have a normal value.
 *
 * @param field a ValueEval which can be a RefEval.
 * @return a ValueEval which is guaranteed not to be a RefEval
 * @throws EvaluationException If a multi-sheet reference was found along the way.
 *//*from   ww  w.j  a  va2  s .co m*/
private static ValueEval solveReference(ValueEval field) throws EvaluationException {
    if (field instanceof RefEval) {
        RefEval refEval = (RefEval) field;
        if (refEval.getNumberOfSheets() > 1) {
            throw new EvaluationException(ErrorEval.VALUE_INVALID);
        }
        return solveReference(refEval.getInnerValueEval(refEval.getFirstSheetIndex()));
    } else {
        return field;
    }
}