Example usage for org.apache.poi.ss.util PaneInformation getHorizontalSplitPosition

List of usage examples for org.apache.poi.ss.util PaneInformation getHorizontalSplitPosition

Introduction

In this page you can find the example usage for org.apache.poi.ss.util PaneInformation getHorizontalSplitPosition.

Prototype

public short getHorizontalSplitPosition() 

Source Link

Document

Returns the horizontal position of the split.

Usage

From source file:com.vaadin.addon.spreadsheet.SpreadsheetFactory.java

License:Open Source License

/**
 * Loads freeze pane configuration for the currently active sheet and sets
 * it into the shared state.//from w  w  w.j ava2  s.c o  m
 *
 * @param spreadsheet
 *            Target Spreadsheet
 */
static void loadFreezePane(Spreadsheet spreadsheet) {
    final Sheet sheet = spreadsheet.getActiveSheet();
    PaneInformation paneInformation = sheet.getPaneInformation();
    // only freeze panes supported
    if (paneInformation != null && paneInformation.isFreezePane()) {
        /*
         * In POI, HorizontalSplitPosition means rows and
         * VerticalSplitPosition means columns. Changed the meaning for the
         * component internals. The left split column / top split row is the
         * *absolute* index of the first unfrozen column / row.
         */
        spreadsheet.getState().horizontalSplitPosition = paneInformation.getVerticalSplitLeftColumn();
        spreadsheet.getState().verticalSplitPosition = paneInformation.getHorizontalSplitTopRow();

        /*
         * If the view was scrolled down / right when panes were frozen, the
         * invisible frozen rows/columns are effectively hidden in Excel. We
         * mimic this behavior here.
         */
        for (int col = 0; col < Math.max(0, paneInformation.getVerticalSplitLeftColumn()
                - paneInformation.getVerticalSplitPosition()); col++) {
            spreadsheet.setColumnHidden(col, true);
        }
        for (int row = 0; row < Math.max(0, paneInformation.getHorizontalSplitTopRow()
                - paneInformation.getHorizontalSplitPosition()); row++) {
            spreadsheet.setRowHidden(row, true);
        }
    } else {
        spreadsheet.getState().verticalSplitPosition = 0;
        spreadsheet.getState().horizontalSplitPosition = 0;
    }
}

From source file:org.bbreak.excella.reports.ReportsTestUtil.java

License:Open Source License

/**
 * ????/* w ww. j  a v  a 2 s.  co  m*/
 * 
 * @param information 
 * @return ??
 */
private static String getPaneInformationString(PaneInformation information) {
    StringBuffer sb = new StringBuffer();
    if (information != null) {
        sb.append("HorizontalSplitPosition=").append(information.getHorizontalSplitPosition()).append(",");
        sb.append("HorizontalSplitTopRow=").append(information.getHorizontalSplitTopRow()).append(",");
        sb.append("VerticalSplitPosition=").append(information.getVerticalSplitPosition()).append(",");
        sb.append("VerticalSplitLeftColumn=").append(information.getVerticalSplitLeftColumn());
    }
    return sb.toString();
}