]> source.dussan.org Git - poi.git/commitdiff
Fix bug #49381 - Correct createFreezePane in XSSF, so that the left row/column matche...
authorNick Burch <nick@apache.org>
Fri, 18 Mar 2011 16:38:58 +0000 (16:38 +0000)
committerNick Burch <nick@apache.org>
Fri, 18 Mar 2011 16:38:58 +0000 (16:38 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1082966 13f79535-47bb-0310-9956-ffa450edef68

src/documentation/content/xdocs/status.xml
src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java

index fa77fbdf19e034a24421a913dcdf3ab950948a3d..30170329c364374d8fc430b165df71c99a37e841 100644 (file)
@@ -34,6 +34,7 @@
 
     <changes>
         <release version="3.8-beta2" date="2011-??-??">
+           <action dev="poi-developers" type="fix">49381 - Correct createFreezePane in XSSF, so that the left row/column matches the documentation + HSSF</action>
            <action dev="poi-developers" type="fix">49253 - When setting repeating rows and columns for XSSF, don't break the print settings if they were already there</action>
            <action dev="poi-developers" type="fix">49219 - ExternalNameRecord support for DDE Link entries without an operation</action>
            <action dev="poi-developers" type="fix">50846 - More XSSFColor theme improvements, this time for Cell Borders</action>
index 73628516a6aefada37899ab9567044d37d17c3fa..52dc4afeebed6b3885c599a0573bc716b912ad6f 100644 (file)
@@ -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);
         }
 
index 2ab17d1ad1417b146676c6268cdcea3032ede67b..9928949a27d5ced691771784ae932ed3865edf26 100644 (file)
@@ -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<leftmostColumn; cn++) {
+                Cell c = r.createCell(cn, Cell.CELL_TYPE_NUMERIC);
+                c.setCellValue(100*rn + cn);
+             }
+          }
+          
+          // Create the Freeze Pane
+          s.createFreezePane(colSplit, rowSplit, leftmostColumn, topRow);
+          PaneInformation paneInfo = s.getPaneInformation();
+          
+          // Check it
+          assertEquals(colSplit,       paneInfo.getVerticalSplitPosition());
+          assertEquals(rowSplit,       paneInfo.getHorizontalSplitPosition());
+          assertEquals(leftmostColumn, paneInfo.getVerticalSplitLeftColumn());
+          assertEquals(topRow,         paneInfo.getHorizontalSplitTopRow());
+       }
+    }
 }