List of usage examples for org.apache.poi.ss.util PaneInformation isFreezePane
public boolean isFreezePane()
From source file:com.vaadin.addon.spreadsheet.Spreadsheet.java
License:Open Source License
/** * Removes the freeze pane from the currently active sheet if one is * present./*from w w w .j av a 2s . c o m*/ */ public void removeFreezePane() { PaneInformation paneInformation = getActiveSheet().getPaneInformation(); if (paneInformation != null && paneInformation.isFreezePane()) { getActiveSheet().createFreezePane(0, 0); SpreadsheetFactory.loadFreezePane(this); reloadActiveSheetData(); } }
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.//ww w . jav a2 s.co 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; } }