diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java index 6b3348aa4..178bb37a4 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java @@ -1792,4 +1792,16 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss recalc.setEngineId(0); } + /** + * Whether Excel will be asked to recalculate all formulas when the workbook is opened. + * + * @since 3.8 + */ + public boolean getForceFormulaRecalculation(){ + InternalWorkbook iwb = getWorkbook(); + RecalcIdRecord recalc = (RecalcIdRecord)iwb.findFirstRecordBySid(RecalcIdRecord.sid); + return recalc != null && recalc.getEngineId() != 0; + } + + } diff --git a/src/java/org/apache/poi/ss/usermodel/Sheet.java b/src/java/org/apache/poi/ss/usermodel/Sheet.java index bb4810f50..b7c145c26 100644 --- a/src/java/org/apache/poi/ss/usermodel/Sheet.java +++ b/src/java/org/apache/poi/ss/usermodel/Sheet.java @@ -319,7 +319,7 @@ public interface Sheet extends Iterable { void setForceFormulaRecalculation(boolean value); /** - * Whether Excel will be asked to recalculate all formulas when the + * Whether Excel will be asked to recalculate all formulas in this sheet when the * workbook is opened. */ boolean getForceFormulaRecalculation(); diff --git a/src/java/org/apache/poi/ss/usermodel/Workbook.java b/src/java/org/apache/poi/ss/usermodel/Workbook.java index 6ca460168..3ee44fdc1 100644 --- a/src/java/org/apache/poi/ss/usermodel/Workbook.java +++ b/src/java/org/apache/poi/ss/usermodel/Workbook.java @@ -564,4 +564,11 @@ public interface Workbook { */ public void setForceFormulaRecalculation(boolean value); + /** + * Whether Excel will be asked to recalculate all formulas when the workbook is opened. + * + * @since 3.8 + */ + boolean getForceFormulaRecalculation(); + } diff --git a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java index 6ca1f51e6..6ba4137b5 100644 --- a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java +++ b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java @@ -835,5 +835,12 @@ public class SXSSFWorkbook implements Workbook _wb.setForceFormulaRecalculation(value); } + /** + * Whether Excel will be asked to recalculate all formulas when the workbook is opened. + */ + public boolean getForceFormulaRecalculation(){ + return _wb.getForceFormulaRecalculation(); + } + //end of interface implementation } diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java index 95cbe7359..d8689d87a 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java @@ -1596,4 +1596,16 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Iterable