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

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

本文整理了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

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

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

  1. /**
  2. * Returns the Workbook that this Cell is bound to
  3. */
  4. protected InternalWorkbook getBoundWorkbook() {
  5. return _book.getWorkbook();
  6. }

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

  1. private HSSFEvaluationWorkbook(HSSFWorkbook book) {
  2. _uBook = book;
  3. _iBook = book.getWorkbook();
  4. }

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

  1. /**
  2. * Verifies that this style belongs to the supplied Workbook.
  3. * Will throw an exception if it belongs to a different one.
  4. * This is normally called when trying to assign a style to a
  5. * cell, to ensure the cell and the style are from the same
  6. * workbook (if they're not, it won't work)
  7. * @throws IllegalArgumentException if there's a workbook mis-match
  8. */
  9. public void verifyBelongsToWorkbook(HSSFWorkbook wb) {
  10. if(wb.getWorkbook() != _workbook) {
  11. 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?");
  12. }
  13. }

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

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

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

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

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

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

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

  1. /**
  2. * Whether Excel will be asked to recalculate all formulas when the workbook is opened.
  3. *
  4. * @since 3.8
  5. */
  6. @Override
  7. public boolean getForceFormulaRecalculation(){
  8. InternalWorkbook iwb = getWorkbook();
  9. RecalcIdRecord recalc = (RecalcIdRecord)iwb.findFirstRecordBySid(RecalcIdRecord.sid);
  10. return recalc != null && recalc.getEngineId() != 0;
  11. }

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

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

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

  1. private static boolean isUserDefined(HSSFWorkbook workbook, int index) {
  2. StyleRecord styleRecord = workbook.getWorkbook().getStyleRecord(index);
  3. return styleRecord != null &&
  4. !styleRecord.isBuiltin() &&
  5. styleRecord.getName() != null;
  6. }
  7. }

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

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

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

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

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

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

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

  1. /**
  2. * @return new unique shapeId
  3. */
  4. int newShapeId() {
  5. DrawingManager2 dm = _sheet.getWorkbook().getWorkbook().getDrawingManager();
  6. EscherDgRecord dg =
  7. _boundAggregate.getEscherContainer().getChildById(EscherDgRecord.RECORD_ID);
  8. return dm.allocateShapeId(dg);
  9. }

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

  1. /**
  2. * Return the dimension of the embedded image in pixel
  3. *
  4. * @return image dimension in pixels
  5. */
  6. @Override
  7. public Dimension getImageDimension(){
  8. InternalWorkbook iwb = getPatriarch().getSheet().getWorkbook().getWorkbook();
  9. EscherBSERecord bse = iwb.getBSERecord(getPictureIndex());
  10. byte[] data = bse.getBlipRecord().getPicturedata();
  11. int type = bse.getBlipTypeWin32();
  12. return ImageUtils.getImageDimension(new ByteArrayInputStream(data), type);
  13. }

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

  1. void afterCreate() {
  2. DrawingManager2 drawingManager = _sheet.getWorkbook().getWorkbook().getDrawingManager();
  3. short dgId = drawingManager.findNewDrawingGroupId();
  4. _boundAggregate.setDgId(dgId);
  5. _boundAggregate.setMainSpRecordId(newShapeId());
  6. drawingManager.incrementDrawingsSaved();
  7. }

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

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

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

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

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

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

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

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

相关文章

HSSFWorkbook类方法