* @param rowSplit Vertical position of split.
* @param leftmostColumn Left column visible in right pane.
* @param topRow Top row visible in bottom pane
*/
public void createFreezePane(int colSplit, int rowSplit, int leftmostColumn, int topRow) {
CTSheetView ctView = getDefaultSheetView();
// If both colSplit and rowSplit are zero then the existing freeze pane is removed
if(colSplit == 0 && rowSplit == 0){
if(ctView.isSetPane()) ctView.unsetPane();
ctView.setSelectionArray(null);
return;
}
if (!ctView.isSetPane()) {
ctView.addNewPane();
}
CTPane pane = ctView.getPane();
if (colSplit > 0) {
pane.setXSplit(colSplit);
} else {
if(pane.isSetXSplit()) pane.unsetXSplit();
}
if (rowSplit > 0) {
pane.setYSplit(rowSplit);
} else {
if(pane.isSetYSplit()) pane.unsetYSplit();
}
pane.setState(STPaneState.FROZEN);
if (rowSplit == 0) {
pane.setTopLeftCell(new CellReference(0, leftmostColumn).formatAsString());
pane.setActivePane(STPane.TOP_RIGHT);
} else if (colSplit == 0) {
pane.setTopLeftCell(new CellReference(topRow, 0).formatAsString());
pane.setActivePane(STPane.BOTTOM_LEFT);
} else {
pane.setTopLeftCell(new CellReference(topRow, leftmostColumn).formatAsString());
pane.setActivePane(STPane.BOTTOM_RIGHT);
}
ctView.setSelectionArray(null);
CTSelection sel = ctView.addNewSelection();
sel.setPane(pane.getActivePane());
}