org.apache.poi.hssf.usermodel.HSSFSheet.getSheet()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(8.5k)|赞(0)|评价(0)|浏览(191)

本文整理了Java中org.apache.poi.hssf.usermodel.HSSFSheet.getSheet()方法的一些代码示例,展示了HSSFSheet.getSheet()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HSSFSheet.getSheet()方法的具体详情如下:
包路径:org.apache.poi.hssf.usermodel.HSSFSheet
类名称:HSSFSheet
方法名:getSheet

HSSFSheet.getSheet介绍

[英]used internally in the API to get the low level Sheet record represented by this Object.
[中]在API内部使用,以获取此对象表示的低级工作表记录。

代码示例

代码示例来源:origin: org.apache.poi/poi

/**
 * 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();
}

代码示例来源:origin: org.apache.poi/poi

/* package */ HSSFSheetConditionalFormatting(HSSFSheet sheet) {
  _sheet = sheet;
  _conditionalFormattingTable = sheet.getSheet().getConditionalFormattingTable();
}

代码示例来源:origin: org.apache.poi/poi

/**
 * 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);
}

代码示例来源:origin: org.apache.poi/poi

/**
 * Returns whether gridlines are printed.
 *
 * @return Gridlines are printed
 */
@Override
public boolean isPrintGridlines() {
  return getSheet().getPrintGridlines().getPrintGridlines();
}

代码示例来源:origin: org.apache.poi/poi

/**
 * 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);
}

代码示例来源:origin: org.apache.poi/poi

/**
 * 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);
}

代码示例来源:origin: org.apache.poi/poi

/**
 * Returns whether row and column headings are printed.
 *
 * @return row and column headings are printed
 */
@Override
public boolean isPrintRowAndColumnHeadings() {
  return getSheet().getPrintHeaders().getPrintHeaders();
}

代码示例来源:origin: org.apache.poi/poi

/**
 * 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);
}

代码示例来源:origin: org.apache.poi/poi

/**
 * @return <code>true</code> if this sheet is currently focused
 */
public boolean isActive() {
  return getSheet().getWindowTwo().isActive();
}

代码示例来源:origin: org.apache.poi/poi

/**
 * {@inheritDoc}
 */
@Override
public void setAsActiveCell()
{
  int row=_record.getRow();
  short col=_record.getColumn();
  _sheet.getSheet().setActiveCellRow(row);
  _sheet.getSheet().setActiveCellCol(col);
}

代码示例来源:origin: org.apache.poi/poi

/**
 * 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();
}

代码示例来源:origin: org.apache.poi/poi

/**
 * 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);
}

代码示例来源:origin: org.apache.poi/poi

/**
 * 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;
}

代码示例来源:origin: org.apache.poi/poi

/**
 * 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;
      }
    }
  }
}

代码示例来源:origin: org.apache.poi/poi

/**
 * 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);
}

代码示例来源:origin: org.apache.poi/poi

/**
 * 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);
}

代码示例来源:origin: org.apache.poi/poi

/**
 * 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();
}

代码示例来源:origin: org.apache.poi/poi

/**
 * 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);
}

代码示例来源:origin: org.apache.poi/poi

/**
 * 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);
}

代码示例来源:origin: org.apache.poi/poi

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);
}

相关文章

微信公众号

最新文章

更多

HSSFSheet类方法