Bug 47964 - XSSFSheet.createFreezePane mix up of leftmostColumn and topRow in call to CellReference
Summary: XSSFSheet.createFreezePane mix up of leftmostColumn and topRow in call to Cel...
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.5-FINAL
Hardware: PC Windows Vista
: P2 normal with 6 votes (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-08 08:17 UTC by Robert Kent
Modified: 2011-05-10 20:06 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Kent 2009-10-08 08:17:33 UTC
Noticed unusual display when freezing sheet at cell "B3" :

    public void createFreezePane(int colSplit, int rowSplit, int leftmostColumn, int topRow) {
        CTPane pane = getPane();
        if (colSplit > 0) pane.setXSplit(colSplit);
        if (rowSplit > 0) pane.setYSplit(rowSplit);
        pane.setState(STPaneState.FROZEN);
        if (rowSplit == 0) {
            pane.setTopLeftCell(new CellReference(0, topRow).formatAsString());
            pane.setActivePane(STPane.TOP_RIGHT);
        } else if (colSplit == 0) {
            pane.setTopLeftCell(new CellReference(rowSplit, 0).formatAsString());
            pane.setActivePane(STPane.BOTTOM_LEFT);
        } else {
            pane.setTopLeftCell(new CellReference(leftmostColumn, topRow).formatAsString());
            pane.setActivePane(STPane.BOTTOM_RIGHT);
        }

        CTSheetView ctView = getDefaultSheetView();
        ctView.setSelectionArray(null);
        CTSelection sel = ctView.addNewSelection();
        sel.setPane(pane.getActivePane());
    }

the final else has:

            pane.setTopLeftCell(new CellReference(leftmostColumn, topRow).formatAsString());

but CellReference expects (row, column).  

FWIW: 

        if (rowSplit == 0) {
            pane.setTopLeftCell(new CellReference(0, topRow).formatAsString());

also looks like an error.
Comment 1 Scott Miller 2011-05-10 19:34:19 UTC
I just ran into this issue as well. Fixing this issue is simply a matter of correctly switching the two parameters. Seems strange that this has persisted for through several releases.
Comment 2 Nick Burch 2011-05-10 19:47:36 UTC
I think this was fixed in a different bug lately, can you retest with a recent nightly build and see if it is now behaving correctly?
Comment 3 Scott Miller 2011-05-10 20:06:10 UTC
I just checked the svn trunk, and the code has been fixed. Thanks for the quick reply!