From b07c986c9d8b8ef1c09eb593c990d8b5f945094f Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Fri, 18 Mar 2011 16:38:58 +0000 Subject: [PATCH] Fix bug #49381 - Correct createFreezePane in XSSF, so that the left row/column matches the documentation + HSSF (CellReference is row,column) git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1082966 13f79535-47bb-0310-9956-ffa450edef68 --- src/documentation/content/xdocs/status.xml | 1 + .../apache/poi/xssf/usermodel/XSSFSheet.java | 2 +- .../poi/xssf/usermodel/TestXSSFBugs.java | 35 +++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index fa77fbdf19..30170329c3 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ + 49381 - Correct createFreezePane in XSSF, so that the left row/column matches the documentation + HSSF 49253 - When setting repeating rows and columns for XSSF, don't break the print settings if they were already there 49219 - ExternalNameRecord support for DDE Link entries without an operation 50846 - More XSSFColor theme improvements, this time for Cell Borders 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 73628516a6..52dc4afeeb 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java @@ -448,7 +448,7 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet { pane.setTopLeftCell(new CellReference(rowSplit, 0).formatAsString()); pane.setActivePane(STPane.BOTTOM_LEFT); } else { - pane.setTopLeftCell(new CellReference(leftmostColumn, topRow).formatAsString()); + pane.setTopLeftCell(new CellReference(topRow, leftmostColumn).formatAsString()); pane.setActivePane(STPane.BOTTOM_RIGHT); } diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java index 2ab17d1ad1..9928949a27 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java @@ -23,6 +23,7 @@ import java.util.List; import org.apache.poi.POIXMLDocumentPart; import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.hssf.util.PaneInformation; import org.apache.poi.openxml4j.opc.OPCPackage; import org.apache.poi.openxml4j.opc.PackagePart; import org.apache.poi.openxml4j.opc.PackagingURIHelper; @@ -934,4 +935,38 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues { assertEquals(true, ps2.getValidSettings()); assertEquals(false, ps2.getLandscape()); } + + /** + * CreateFreezePane column/row order check + */ + public void test49381() throws Exception { + Workbook[] wbs = new Workbook[] { new HSSFWorkbook(), new XSSFWorkbook() }; + int colSplit = 1; + int rowSplit = 2; + int leftmostColumn = 3; + int topRow = 4; + + for(Workbook wb : wbs) { + Sheet s = wb.createSheet(); + + // Populate + for(int rn=0; rn<= topRow; rn++) { + Row r = s.createRow(rn); + for(int cn=0; cn