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
This commit is contained in:
Nick Burch 2011-03-18 16:38:58 +00:00
parent df49838158
commit 8c44bb85d1
3 changed files with 37 additions and 1 deletions

View 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>

View 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);
}

View 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());
}
}
}