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

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

Introduction

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

Prototype

@Override
public PaneInformation getPaneInformation() 

Source Link

Document

Returns the information regarding the currently configured pane (split or freeze).

Usage

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

License:Apache License

private void normalizeSheet(XSSFSheet sheet, String activeRange) {
    sheet.setZoom(ZOOM_100);/*from ww  w  . j  a  v a 2  s . com*/
    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());
    }
}

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

License:Apache License

private void controlSheet(XSSFWorkbook workbook, String range, int sheetIndex) {
    XSSFSheet sheet = workbook.getSheetAt(sheetIndex);
    if (sheet.getPaneInformation() == null) {
        // Doesn't work with panes
        assertEquals(new CellAddress(range), sheet.getActiveCell());
    }/* www  .  j a v a 2s  .co  m*/
    assertEquals(0, sheet.getTopRow());
    assertEquals(0, sheet.getLeftCol());
    assertFalse(sheet.isDisplayGridlines());
    assertFalse(sheet.isSelected());
}

From source file:uk.co.spudsoft.birt.emitters.excel.tests.Issue56FreezePanes.java

License:Open Source License

@Test
public void testPanes() throws Exception {

    debug = false;/*from ww w .j a  v  a  2  s  .co  m*/
    groupSummaryHeader = true;
    InputStream inputStream = runAndRenderReport("Issue56FreezePanes.rptdesign", "xlsx");
    assertNotNull(inputStream);
    try {
        XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
        assertNotNull(workbook);

        assertEquals(1, workbook.getNumberOfSheets());

        XSSFSheet sheet0 = workbook.getSheetAt(0);

        PaneInformation paneInfo = sheet0.getPaneInformation();
        assertEquals(true, paneInfo.isFreezePane());
        assertEquals(2, paneInfo.getVerticalSplitLeftColumn());
        assertEquals(1, paneInfo.getHorizontalSplitTopRow());
    } finally {
        inputStream.close();
    }

}