/** * Returns the information regarding the currently configured pane (split or freeze). * * @return null if no pane configured, or the pane information. */ @Override public PaneInformation getPaneInformation() { return getSheet().getPaneInformation(); }
/* package */ HSSFSheetConditionalFormatting(HSSFSheet sheet) { _sheet = sheet; _conditionalFormattingTable = sheet.getSheet().getConditionalFormattingTable(); }
/** * Creates a split pane. Any existing freezepane or split pane is overwritten. * * @param xSplitPos Horizonatal position of split (in 1/20th of a point). * @param ySplitPos Vertical position of split (in 1/20th of a point). * @param topRow Top row visible in bottom pane * @param leftmostColumn Left column visible in right pane. * @param activePane Active pane. One of: PANE_LOWER_RIGHT, * PANE_UPPER_RIGHT, PANE_LOWER_LEFT, PANE_UPPER_LEFT * @see #PANE_LOWER_LEFT * @see #PANE_LOWER_RIGHT * @see #PANE_UPPER_LEFT * @see #PANE_UPPER_RIGHT */ @Override public void createSplitPane(int xSplitPos, int ySplitPos, int leftmostColumn, int topRow, int activePane) { getSheet().createSplitPane(xSplitPos, ySplitPos, topRow, leftmostColumn, activePane); }
/** * Returns whether gridlines are printed. * * @return Gridlines are printed */ @Override public boolean isPrintGridlines() { return getSheet().getPrintGridlines().getPrintGridlines(); }
/** * Turns on or off the printing of gridlines. * * @param show boolean to turn on or off the printing of * gridlines */ @Override public void setPrintGridlines(boolean show) { getSheet().getPrintGridlines().setPrintGridlines(show); }
/** * Sets whether sheet is selected. * * @param sel Whether to select the sheet or deselect the sheet. */ public void setActive(boolean sel) { getSheet().getWindowTwo().setActive(sel); }
/** * Returns whether row and column headings are printed. * * @return row and column headings are printed */ @Override public boolean isPrintRowAndColumnHeadings() { return getSheet().getPrintHeaders().getPrintHeaders(); }
/** * Turns on or off the printing of row and column headings. * * @param show boolean to turn on or off the printing of * row and column headings */ @Override public void setPrintRowAndColumnHeadings(boolean show) { getSheet().getPrintHeaders().setPrintHeaders(show); }
/** * @return <code>true</code> if this sheet is currently focused */ public boolean isActive() { return getSheet().getWindowTwo().isActive(); }
/** * Note - this is not the same as whether the sheet is focused (isActive) * * @return <code>true</code> if this sheet is currently selected */ @Override public boolean isSelected() { return getSheet().getWindowTwo().getSelected(); }
/** * Sets whether sheet is selected. * * @param sel Whether to select the sheet or deselect the sheet. */ @Override public void setSelected(boolean sel) { getSheet().getWindowTwo().setSelected(sel); }
/** * get the row's height or ff (-1) for undefined/default-height in twips (1/20th of a point) * @return rowheight or 0xff for undefined (use sheet default) */ @Override public short getHeight() { short height = row.getHeight(); //The low-order 15 bits contain the row height. //The 0x8000 bit indicates that the row is standard height (optional) if ((height & 0x8000) != 0) height = sheet.getSheet().getDefaultRowHeight(); else height &= 0x7FFF; return height; }
/** * Removes the hyperlink for this cell, if there is one. */ public void removeHyperlink() { for (Iterator<RecordBase> it = _sheet.getSheet().getRecords().iterator(); it.hasNext();) { RecordBase rec = it.next(); if (rec instanceof HyperlinkRecord) { HyperlinkRecord link = (HyperlinkRecord) rec; if (link.getFirstColumn() == _record.getColumn() && link.getFirstRow() == _record.getRow()) { it.remove(); return; } } } }
/** * Creates a split (freezepane). Any existing freezepane or split pane is overwritten.<p> * * If both colSplit and rowSplit are zero then the existing freeze pane is removed * * @param colSplit Horizonatal position of split. * @param rowSplit Vertical position of split. * @param leftmostColumn Left column visible in right pane. * @param topRow Top row visible in bottom pane */ @Override public void createFreezePane(int colSplit, int rowSplit, int leftmostColumn, int topRow) { validateColumn(colSplit); validateRow(rowSplit); if (leftmostColumn < colSplit) throw new IllegalArgumentException("leftmostColumn parameter must not be less than colSplit parameter"); if (topRow < rowSplit) throw new IllegalArgumentException("topRow parameter must not be less than leftmostColumn parameter"); getSheet().createFreezePane(colSplit, rowSplit, topRow, leftmostColumn); }
/** * Sets the zoom magnification for the sheet. The zoom is expressed as a * fraction. For example to express a zoom of 75% use 3 for the numerator * and 4 for the denominator. * * @param numerator The numerator for the zoom magnification. * @param denominator The denominator for the zoom magnification. * @see #setZoom(int) */ public void setZoom(int numerator, int denominator) { if (numerator < 1 || numerator > 65535) throw new IllegalArgumentException("Numerator must be greater than 0 and less than 65536"); if (denominator < 1 || denominator > 65535) throw new IllegalArgumentException("Denominator must be greater than 0 and less than 65536"); SCLRecord sclRecord = new SCLRecord(); sclRecord.setNumerator((short) numerator); sclRecord.setDenominator((short) denominator); getSheet().setSCLRecord(sclRecord); }
/** * Aggregates the drawing records and dumps the escher record hierarchy * to the standard output. */ public void dumpDrawingRecords(boolean fat, PrintWriter pw) { _sheet.aggregateDrawingRecords(_book.getDrawingManager(), false); EscherAggregate r = (EscherAggregate) getSheet().findFirstRecordBySid(EscherAggregate.sid); List<EscherRecord> escherRecords = r.getEscherRecords(); for (EscherRecord escherRecord : escherRecords) { if (fat) { pw.println(escherRecord); } else { escherRecord.display(pw, 0); } } pw.flush(); }
/** * Creates new Cell - Should only be called by HSSFRow. This creates a cell * from scratch. * * @param book - Workbook record of the workbook containing this cell * @param sheet - Sheet record of the sheet containing this cell * @param row - the row of this cell * @param col - the column for this cell * @param type - Type of cell * @see org.apache.poi.hssf.usermodel.HSSFRow#createCell(int,CellType) */ protected HSSFCell(HSSFWorkbook book, HSSFSheet sheet, int row, short col, CellType type) { checkBounds(col); _cellType = CellType._NONE; // Force 'setCellType' to create a first Record _stringValue = null; _book = book; _sheet = sheet; short xfindex = sheet.getSheet().getXFIndexForColAt(col); setCellType(type,false,row,col,xfindex); }
/** * sets the order of appearance for a given sheet. * * @param sheetname the name of the sheet to reorder * @param pos the position that we want to insert the sheet into (0 based) */ @Override public void setSheetOrder(String sheetname, int pos ) { int oldSheetIndex = getSheetIndex(sheetname); _sheets.add(pos,_sheets.remove(oldSheetIndex)); workbook.setSheetOrder(sheetname, pos); FormulaShifter shifter = FormulaShifter.createForSheetShift(oldSheetIndex, pos); for (HSSFSheet sheet : _sheets) { sheet.getSheet().updateFormulasAfterCellShift(shifter, /* not used */ -1 ); } workbook.updateNamesAfterCellShift(shifter); updateNamedRangesAfterSheetReorder(oldSheetIndex, pos); updateActiveSheetAfterSheetReorder(oldSheetIndex, pos); }
private void updateFormulasForShift(FormulaShifter formulaShifter) { int sheetIndex = _workbook.getSheetIndex(this); short externSheetIndex = _book.checkExternSheet(sheetIndex); // update formulas on this sheet that point to rows which have been moved _sheet.updateFormulasAfterCellShift(formulaShifter, externSheetIndex); // update formulas on other sheets that point to rows that have been moved on this sheet int nSheets = _workbook.getNumberOfSheets(); for (int i = 0; i < nSheets; i++) { InternalSheet otherSheet = _workbook.getSheetAt(i).getSheet(); if (otherSheet == this._sheet) { continue; } short otherExtSheetIx = _book.checkExternSheet(i); otherSheet.updateFormulasAfterCellShift(formulaShifter, otherExtSheetIx); } _workbook.getWorkbook().updateNamesAfterCellShift(formulaShifter); }