From 5ea324076a8764a2e3ee79e0774031d21ad98215 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Fri, 9 Sep 2011 15:11:20 +0000 Subject: [PATCH] Patch from bug #51785 - Allow XSSF setForceFormulaRecalculation to work with the minimal ooxml-schemas jar git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1167241 13f79535-47bb-0310-9956-ffa450edef68 --- src/documentation/content/xdocs/status.xml | 1 + .../poi/xssf/usermodel/TestXSSFSheet.java | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index b1682fecdf..246288823b 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ + 51785 - Allow XSSF setForceFormulaRecalculation to work with the minimal ooxml-schemas jar 51772 - IllegalArgumentException Parsing MS Word 97 - 2003 XSLFPowerPointExtractor support for including comment authors with comment text Converted XSLFPowerPointExtractor to use UserModel for all text extraction diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java index ad02fa69e1..141a06fdbf 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java @@ -1063,4 +1063,25 @@ public final class TestXSSFSheet extends BaseTestSheet { XSSFSheet s3 = wb.getSheetAt(2); assertEquals(0, s3.getTables().size()); } + + /** + * Test to trigger OOXML-LITE generating to include org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheetCalcPr + */ + public void testSetForceFormulaRecalculation() { + XSSFWorkbook workbook = new XSSFWorkbook(); + XSSFSheet sheet = workbook.createSheet("Sheet 1"); + + // Set + sheet.setForceFormulaRecalculation(true); + assertEquals(true, sheet.getForceFormulaRecalculation()); + + // Check + sheet.setForceFormulaRecalculation(false); + assertEquals(false, sheet.getForceFormulaRecalculation()); + + // Save, re-load, and re-check + workbook = XSSFTestDataSamples.writeOutAndReadBack(workbook); + sheet = workbook.getSheet("Sheet 1"); + assertEquals(false, sheet.getForceFormulaRecalculation()); + } } -- 2.39.5