Example usage for org.apache.poi.xssf.usermodel XSSFSheet showInPane

List of usage examples for org.apache.poi.xssf.usermodel XSSFSheet showInPane

Introduction

In this page you can find the example usage for org.apache.poi.xssf.usermodel XSSFSheet showInPane.

Prototype

@Override
public void showInPane(int toprow, int leftcol) 

Source Link

Document

Location of the top left visible cell Location of the top left visible cell in the bottom right pane (when in Left-to-Right mode).

Usage

From source file:org.keyboardplaying.xtt.xlsx.XlsxNormalizer.java

License:Apache License

private void normalizeSheet(XSSFSheet sheet, String activeRange) {
    sheet.setZoom(ZOOM_100);//  w  w  w .  j a va 2s. c  o  m
    sheet.setDisplayGridlines(false);
    sheet.setSelected(false);

    PaneInformation pane = sheet.getPaneInformation();
    if (pane == null) {
        /* Reset cell */
        sheet.setActiveCell(new CellAddress(activeRange));
        /* Reset view */
        sheet.getCTWorksheet().getSheetViews().getSheetViewArray(0)
                .setTopLeftCell(CellAddress.A1.formatAsString());
    } else {
        /* Reset cell */
        sheet.createFreezePane(0, 0); // Remove panes
        sheet.setActiveCell(new CellAddress(activeRange));
        sheet.createFreezePane(pane.getVerticalSplitLeftColumn(), pane.getHorizontalSplitTopRow()); // Reset panes
        /* Reset view */
        sheet.showInPane(pane.getHorizontalSplitPosition(), pane.getVerticalSplitPosition());
    }
}