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

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

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

HSSFWorkbook.getWorkbook介绍

暂无

代码示例

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

/** Creates new HSSFCellStyle why would you want to do this?? */
protected HSSFCellStyle(short index, ExtendedFormatRecord rec, HSSFWorkbook workbook)
{
  this(index, rec, workbook.getWorkbook());
}
protected HSSFCellStyle(short index, ExtendedFormatRecord rec, InternalWorkbook workbook)

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

/**
 * Returns the Workbook that this Cell is bound to
 */
protected InternalWorkbook getBoundWorkbook() {
  return _book.getWorkbook();
}

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

private HSSFEvaluationWorkbook(HSSFWorkbook book) {
  _uBook = book;
  _iBook = book.getWorkbook();
}

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

/**
 * Verifies that this style belongs to the supplied Workbook.
 * Will throw an exception if it belongs to a different one.
 * This is normally called when trying to assign a style to a
 *  cell, to ensure the cell and the style are from the same
 *  workbook (if they're not, it won't work)
 * @throws IllegalArgumentException if there's a workbook mis-match
 */
public void verifyBelongsToWorkbook(HSSFWorkbook wb) {
  if(wb.getWorkbook() != _workbook) {
    throw new IllegalArgumentException("This Style does not belong to the supplied Workbook. Are you trying to assign a style from one workbook to the cell of a differnt workbook?");
  }
}

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

/**
 * Delete the printarea for the sheet specified
 * @param sheetIndex Zero-based sheet index (0 = First Sheet)
 */
@Override
public void removePrintArea(int sheetIndex) {
  getWorkbook().removeBuiltinRecord(NameRecord.BUILTIN_PRINT_AREA, sheetIndex+1);
}

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

/**
 * Creates new HSSFSheet   - called by HSSFWorkbook to create a sheet from
 * scratch.  You should not be calling this from application code (its protected anyhow).
 *
 * @param workbook - The HSSF Workbook object associated with the sheet.
 * @see org.apache.poi.hssf.usermodel.HSSFWorkbook#createSheet()
 */
protected HSSFSheet(HSSFWorkbook workbook) {
  _sheet = InternalSheet.createSheet();
  _rows = new TreeMap<>();
  this._workbook = workbook;
  this._book = workbook.getWorkbook();
}

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

/** Get the sheets name which this named range is referenced to
 * @return sheet name, which this named range referred to
 */
public String getSheetName() {
  int indexToExternSheet = _definedNameRec.getExternSheetNumber();
  return _book.getWorkbook().findSheetFirstNameFromExternSheet(indexToExternSheet);
}

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

/**
 * Whether Excel will be asked to recalculate all formulas when the  workbook is opened.
 *
 * @since 3.8
 */
@Override
public boolean getForceFormulaRecalculation(){
  InternalWorkbook iwb = getWorkbook();
  RecalcIdRecord recalc = (RecalcIdRecord)iwb.findFirstRecordBySid(RecalcIdRecord.sid);
  return recalc != null && recalc.getEngineId() != 0;
}

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

/**
 * set a date value for the cell. Excel treats dates as numeric so you will need to format the cell as
 * a date.
 *
 * @param value  the date value to set this cell to.  For formulas we'll set the
 *        precalculated value, for numerics we'll set its value. For other types we
 *        will change the cell to a numeric cell and set its value.
 */
public void setCellValue(Date value)
{
  setCellValue(HSSFDateUtil.getExcelDate(value, _book.getWorkbook().isUsing1904DateWindowing()));
}

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

private static boolean isUserDefined(HSSFWorkbook workbook, int index) {
    StyleRecord styleRecord = workbook.getWorkbook().getStyleRecord(index);
    return styleRecord != null &&
        !styleRecord.isBuiltin() &&
        styleRecord.getName() != null;
  }
}

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

/**
 * get the style for the cell.  This is a reference to a cell style contained in the workbook
 * object.
 * @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getCellStyleAt(int)
 */
public HSSFCellStyle getCellStyle()
{
 short styleIndex=_record.getXFIndex();
 ExtendedFormatRecord xf = _book.getWorkbook().getExFormatAt(styleIndex);
 return new HSSFCellStyle(styleIndex, xf, _book);
}

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

/**
 * Get the contents of the format string, by looking up
 *  the DataFormat against the supplied workbook
 * @see org.apache.poi.hssf.usermodel.HSSFDataFormat
 *
 * @return the format string or "General" if not found
 */
public String getDataFormatString(org.apache.poi.ss.usermodel.Workbook workbook) {
  HSSFDataFormat format = new HSSFDataFormat( ((HSSFWorkbook)workbook).getWorkbook() );
  int idx = getDataFormat();
  return idx == -1 ? "General" : format.getFormat(getDataFormat());
}
/**

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

/**
 * Returns the whole-row cell styles. Most rows won't
 *  have one of these, so will return null. Call
 *  {@link #isFormatted()} to check first.
 */
@Override
public HSSFCellStyle getRowStyle() {
  if(!isFormatted()) { return null; }
  short styleIndex = row.getXFIndex();
  ExtendedFormatRecord xf = book.getWorkbook().getExFormatAt(styleIndex);
  return new HSSFCellStyle(styleIndex, xf, book);
}
/**

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

/**
 * @return new unique shapeId
 */
int newShapeId() {
  DrawingManager2 dm = _sheet.getWorkbook().getWorkbook().getDrawingManager();
  EscherDgRecord dg =
      _boundAggregate.getEscherContainer().getChildById(EscherDgRecord.RECORD_ID);
  return dm.allocateShapeId(dg);
}

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

/**
 * Return the dimension of the embedded image in pixel
 *
 * @return image dimension in pixels
 */
@Override
public Dimension getImageDimension(){
  InternalWorkbook iwb = getPatriarch().getSheet().getWorkbook().getWorkbook();
  EscherBSERecord bse = iwb.getBSERecord(getPictureIndex());
  byte[] data = bse.getBlipRecord().getPicturedata();
  int type = bse.getBlipTypeWin32();
  return ImageUtils.getImageDimension(new ByteArrayInputStream(data), type);
}

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

void afterCreate() {
  DrawingManager2 drawingManager = _sheet.getWorkbook().getWorkbook().getDrawingManager();
  short dgId = drawingManager.findNewDrawingGroupId();
  _boundAggregate.setDgId(dgId);
  _boundAggregate.setMainSpRecordId(newShapeId());
  drawingManager.incrementDrawingsSaved();
}

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

public void setBackgroundImage(int pictureIndex){
  setPropertyValue(new EscherSimpleProperty( EscherProperties.FILL__PATTERNTEXTURE, false, true, pictureIndex));
  setPropertyValue(new EscherSimpleProperty( EscherProperties.FILL__FILLTYPE, false, false, FILL_TYPE_PICTURE));
  EscherBSERecord bse = getPatriarch().getSheet().getWorkbook().getWorkbook().getBSERecord(pictureIndex);
  bse.setRef(bse.getRef() + 1);
}

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

@Override
void afterInsert(HSSFPatriarch patriarch) {
  EscherAggregate agg = patriarch.getBoundAggregate();
  agg.associateShapeToObjRecord(getEscherContainer().getChildById(EscherClientDataRecord.RECORD_ID), getObjRecord());
  EscherBSERecord bse =
      patriarch.getSheet().getWorkbook().getWorkbook().getBSERecord(getPictureIndex());
  bse.setRef(bse.getRef() + 1);
}

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

@Override
void afterInsert(HSSFPatriarch patriarch) {
  EscherAggregate agg = patriarch.getBoundAggregate();
  agg.associateShapeToObjRecord(getEscherContainer().getChildById(EscherClientDataRecord.RECORD_ID), getObjRecord());
  if(getPictureIndex() != -1) {
    EscherBSERecord bse =
        patriarch.getSheet().getWorkbook().getWorkbook().getBSERecord(getPictureIndex());
    bse.setRef(bse.getRef() + 1);
  }
}

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

public void resetBackgroundImage(){
  EscherSimpleProperty property = getOptRecord().lookup(EscherProperties.FILL__PATTERNTEXTURE);
  if (null != property){
    EscherBSERecord bse = getPatriarch().getSheet().getWorkbook().getWorkbook().getBSERecord(property.getPropertyValue());
    bse.setRef(bse.getRef() - 1);
    getOptRecord().removeEscherProperty(EscherProperties.FILL__PATTERNTEXTURE);
  }
  setPropertyValue(new EscherSimpleProperty( EscherProperties.FILL__FILLTYPE, false, false, FILL_TYPE_SOLID));
}

相关文章

HSSFWorkbook类方法