poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fannin...@apache.org
Subject svn commit: r1856650 - in /poi/trunk/src/ooxml: java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java testcases/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java
Date Sat, 30 Mar 2019 23:59:19 GMT
Author: fanningpj
Date: Sat Mar 30 23:59:19 2019
New Revision: 1856650

URL: http://svn.apache.org/viewvc?rev=1856650&view=rev
Log:
[bug-61700] getForceFormulaRecalculation() returns wrong value. Fix thanks to Kai G

Modified:
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java?rev=1856650&r1=1856649&r2=1856650&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java Sat Mar 30 23:59:19
2019
@@ -2239,7 +2239,7 @@ public class XSSFWorkbook extends POIXML
     public boolean getForceFormulaRecalculation(){
         CTWorkbook ctWorkbook = getCTWorkbook();
         CTCalcPr calcPr = ctWorkbook.getCalcPr();
-        return calcPr != null && calcPr.getCalcId() != 0;
+        return calcPr != null && calcPr.getCalcId() != 1;
     }
 
 

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java?rev=1856650&r1=1856649&r2=1856650&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java Sat
Mar 30 23:59:19 2019
@@ -500,7 +500,7 @@ public final class TestXSSFWorkbook exte
 
             wb.setForceFormulaRecalculation(true); // resets the EngineId flag to zero
             assertEquals(0, (int) calcPr.getCalcId());
-            assertFalse(wb.getForceFormulaRecalculation());
+            assertTrue(wb.getForceFormulaRecalculation());
 
             // calcMode="manual" is unset when forceFormulaRecalculation=true
             calcPr.setCalcMode(STCalcMode.MANUAL);
@@ -1143,4 +1143,26 @@ public final class TestXSSFWorkbook exte
 
         wb.close();
     }
+    
+    /**
+     * See bug #61700 test data tables
+     *
+     * @throws Exception
+     */
+    @Test
+    public void testWorkbookForceFormulaRecalculation() throws Exception {
+        Workbook workbook = _testDataProvider.createWorkbook();
+        workbook.createSheet().createRow(0).createCell(0).setCellFormula("B1+C1");
+        workbook.getCreationHelper().createFormulaEvaluator().evaluateAll();
+
+        assertFalse(workbook.getForceFormulaRecalculation());
+        workbook.setForceFormulaRecalculation(true);
+        assertTrue(workbook.getForceFormulaRecalculation());
+
+        Workbook wbBack = _testDataProvider.writeOutAndReadBack(workbook);
+        assertTrue(wbBack.getForceFormulaRecalculation());
+
+        workbook.close();
+        wbBack.close();
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message