return _evaluator.getEvalForCell(sheetIndex, getRow(), getColumn());
}
+ /**
+ * @return the Eval of the first sheet associated with this LazyRefEval
+ * @since POI 5.3.1
+ */
+ public ValueEval getInnerValueEvalForFirstSheet() {
+ return _evaluator.getEvalForCell(_evaluator.getFirstSheetIndex(), getRow(), getColumn());
+ }
+
public AreaEval offset(int relFirstRowIx, int relLastRowIx, int relFirstColIx, int relLastColIx) {
AreaI area = new OffsetArea(getRow(), getColumn(),
package org.apache.poi.ss.formula.eval;
import org.apache.poi.ss.formula.EvaluationCell;
+import org.apache.poi.ss.formula.LazyRefEval;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.ss.util.CellRangeAddress;
}
return dd;
}
+ if (ev instanceof LazyRefEval) {
+ final LazyRefEval lre = (LazyRefEval) ev;
+ final ValueEval innerValueEval = lre.getInnerValueEvalForFirstSheet();
+ if (innerValueEval == ev) {
+ throw new IllegalStateException("Circular lazy reference " + lre);
+ }
+ return coerceValueToDouble(innerValueEval);
+ }
throw new IllegalStateException("Unexpected arg eval type (" + ev.getClass().getName() + ")");
}
cellB1.setCellValue(5);
Cell cellResult = sheet.createRow(1).createCell(0);
HSSFFormulaEvaluator fe = new HSSFFormulaEvaluator(wb);
- assertDouble(fe, cellResult, "WORKDAY(A1,5)", DateUtil.getExcelDate(LocalDate.parse("2024-11-05")));
+ assertDouble(fe, cellResult, "WORKDAY(A1,B1)", DateUtil.getExcelDate(LocalDate.parse("2024-11-05")));
}
}
}