diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index 90fdb8838c..69870b19c5 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ + 53950 - fixed setForceFormulaRecalculation to reset workbook-level "manual" flag 52211 - avoid unnessary re-coverting content types to US-ASCII, it can cause exceptions on ibm mainframes 53568 - Set shapes anchors in XSSF when reading from existing drawings HSSFOptimiser will now also tidy away un-used cell styles, in addition to duplicate styles diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java index ccf2419873..438b1ef328 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java @@ -1502,7 +1502,9 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet { * @see org.apache.poi.ss.usermodel.Workbook#setForceFormulaRecalculation(boolean) */ public void setForceFormulaRecalculation(boolean value) { - if(worksheet.isSetSheetCalcPr()) { + CTCalcPr calcPr = getWorkbook().getCTWorkbook().getCalcPr(); + + if(worksheet.isSetSheetCalcPr()) { // Change the current setting CTSheetCalcPr calc = worksheet.getSheetCalcPr(); calc.setFullCalcOnLoad(value); @@ -1512,9 +1514,10 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet { CTSheetCalcPr calc = worksheet.addNewSheetCalcPr(); calc.setFullCalcOnLoad(value); } - else { - // Not set, requested not, nothing to do - } + if(value && calcPr != null && calcPr.getCalcMode() == STCalcMode.MANUAL) { + calcPr.setCalcMode(STCalcMode.AUTO); + } + } /** 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 639a78d423..f50c42a150 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java @@ -1672,6 +1672,10 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Iterable