From db553fd510e996b03c6479254f9c4505dd0813a5 Mon Sep 17 00:00:00 2001 From: Yegor Kozlov Date: Sat, 18 Apr 2009 09:06:16 +0000 Subject: [PATCH] read GutsRecord in in the Sheet(RecordStream rs) constructor (see bugzilla 46186); always call sheet.setAlternativeExpression in conjuction with sheet.setRowSumsBelow, see bugzilla 46714 and 30714 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@766273 13f79535-47bb-0310-9956-ffa450edef68 --- src/documentation/content/xdocs/changes.xml | 2 ++ src/documentation/content/xdocs/status.xml | 2 ++ src/java/org/apache/poi/hssf/model/Sheet.java | 4 ++++ src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java | 2 ++ .../org/apache/poi/hssf/usermodel/TestHSSFSheet.java | 4 ++-- .../org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java | 2 -- 6 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/documentation/content/xdocs/changes.xml b/src/documentation/content/xdocs/changes.xml index 087588e7e..45ca4c6bd 100644 --- a/src/documentation/content/xdocs/changes.xml +++ b/src/documentation/content/xdocs/changes.xml @@ -37,6 +37,8 @@ + 46186 - Fixed Sheet to read GutsRecord in the Sheet(RecordStream rs) + 46714 - Automatically call sheet.setAlternativeExpression when sheet.setRowSumsBelow is called 46279 - Allow 255 arguments for excel functions in XSSF 47028 - Fixed XSSFCell to preserve cell style when cell value is set to blank 47026 - Avoid NPE in XSSFCell.setCellType() when workbook does not have SST diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index 5bccbf28c..1c50ca1b7 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,8 @@ + 46186 - Fixed Sheet to read GutsRecord in the Sheet(RecordStream rs) + 46714 - Automatically call sheet.setAlternativeExpression when sheet.setRowSumsBelow is called 46279 - Allow 255 arguments for excel functions in XSSF 47028 - Fixed XSSFCell to preserve cell style when cell value is set to blank 47026 - Avoid NPE in XSSFCell.setCellType() when workbook does not have SST diff --git a/src/java/org/apache/poi/hssf/model/Sheet.java b/src/java/org/apache/poi/hssf/model/Sheet.java index 825655642..40a2e1e92 100644 --- a/src/java/org/apache/poi/hssf/model/Sheet.java +++ b/src/java/org/apache/poi/hssf/model/Sheet.java @@ -337,6 +337,10 @@ public final class Sheet implements Model { { password = (PasswordRecord) rec; } + else if ( recSid == GutsRecord.sid ) + { + _gutsRecord = (GutsRecord) rec; + } records.add(rec); } diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java b/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java index cf81a8568..64a5bc190 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java @@ -774,6 +774,8 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet { (WSBoolRecord) _sheet.findFirstRecordBySid(WSBoolRecord.sid); record.setRowSumsBelow(b); + //setAlternateExpression must be set in conjuction with setRowSumsBelow + record.setAlternateExpression(b); } /** diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java index af5395782..abed228de 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java @@ -125,7 +125,7 @@ public final class TestHSSFSheet extends BaseTestSheet { s.setRowSumsRight(true); // Check - assertEquals(false, record.getAlternateExpression()); + assertEquals(true, record.getAlternateExpression()); //sheet.setRowSumsBelow alters this field too assertEquals(false, record.getAlternateFormula()); assertEquals(true, record.getAutobreaks()); assertEquals(true, record.getDialog()); @@ -133,7 +133,7 @@ public final class TestHSSFSheet extends BaseTestSheet { assertEquals(false, record.getFitToPage()); assertEquals(true, record.getRowSumsBelow()); assertEquals(true, record.getRowSumsRight()); - assertEquals(false, s.getAlternateExpression()); + assertEquals(true, s.getAlternateExpression()); assertEquals(false, s.getAlternateFormula()); assertEquals(true, s.getAutobreaks()); assertEquals(true, s.getDialog()); diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java index adbcaad94..095456f96 100755 --- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java +++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java @@ -17,11 +17,9 @@ package org.apache.poi.ss.usermodel; import junit.framework.TestCase; -import junit.framework.AssertionFailedError; import org.apache.poi.ss.ITestDataProvider; import org.apache.poi.ss.SpreadsheetVersion; import org.apache.poi.ss.util.CellRangeAddress; -import org.apache.poi.xssf.usermodel.XSSFWorkbook; /** * A base class for bugzilla issues that can be described in terms of common ss interfaces.