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

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

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

HSSFPicture.getPatriarch介绍

暂无

代码示例

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

/**
   * @return the sheet which contains the picture shape
   */
  @Override
  public HSSFSheet getSheet() {
    return getPatriarch().getSheet();
  }
}

代码示例来源: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

/**
 * Return picture data for this shape
 *
 * @return picture data for this shape or {@code null} if picture wasn't embedded, i.e. external linked
 */
@Override
public HSSFPictureData getPictureData(){
  int picIdx = getPictureIndex();
  if (picIdx == -1) {
    return null;
  }
  
  HSSFPatriarch patriarch = getPatriarch();
  HSSFShape parent = getParent();
  while(patriarch == null && parent != null) {
    patriarch = parent.getPatriarch();
    parent = parent.getParent();
  }
  if(patriarch == null) {
    throw new IllegalStateException("Could not find a patriarch for a HSSPicture");
  }
  InternalWorkbook iwb = patriarch.getSheet().getWorkbook().getWorkbook();
  EscherBSERecord bse = iwb.getBSERecord(picIdx);
  EscherBlipRecord blipRecord = bse.getBlipRecord();
  return new HSSFPictureData(blipRecord);
}

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

/**
   * @return the sheet which contains the picture shape
   */
  @Override
  public HSSFSheet getSheet() {
    return getPatriarch().getSheet();
  }
}

代码示例来源:origin: com.haulmont.thirdparty/poi

private float getPixelWidth(int column){
  int def = getPatriarch().getSheet().getDefaultColumnWidth()*256;
  int cw = getPatriarch().getSheet().getColumnWidth(column);
  return cw == def ? PX_DEFAULT : PX_MODIFIED;
}

代码示例来源:origin: com.haulmont.thirdparty/poi

private float getRowHeightInPixels(int i){
  HSSFRow row = getPatriarch().getSheet().getRow(i);
  float height;
  if(row != null) height = row.getHeight();
  else height = getPatriarch().getSheet().getDefaultRowHeight();
  return height/PX_ROW;
}

代码示例来源:origin: com.haulmont.thirdparty/poi

private float getColumnWidthInPixels(int column){
  int cw = getPatriarch().getSheet().getColumnWidth(column);
  float px = getPixelWidth(column);
  return cw/px;
}

代码示例来源:origin: com.haulmont.thirdparty/poi

/**
 * Return the dimension of this image
 *
 * @return image dimension
 */
public Dimension getImageDimension(){
  EscherBSERecord bse = getPatriarch().getSheet()._book.getBSERecord(getPictureIndex());
  byte[] data = bse.getBlipRecord().getPicturedata();
  int type = bse.getBlipTypeWin32();
  return ImageUtils.getImageDimension(new ByteArrayInputStream(data), type);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.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: com.haulmont.thirdparty/poi

/**
 * Return picture data for this shape
 *
 * @return picture data for this shape
 */
public HSSFPictureData getPictureData(){
  InternalWorkbook iwb = getPatriarch().getSheet().getWorkbook().getWorkbook();
  EscherBlipRecord blipRecord = iwb.getBSERecord(getPictureIndex()).getBlipRecord();
  return new HSSFPictureData(blipRecord);
}

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

/**
 * Return picture data for this shape
 *
 * @return picture data for this shape or {@code null} if picture wasn't embedded, i.e. external linked
 */
@Override
public HSSFPictureData getPictureData(){
  int picIdx = getPictureIndex();
  if (picIdx == -1) {
    return null;
  }
  
  HSSFPatriarch patriarch = getPatriarch();
  HSSFShape parent = getParent();
  while(patriarch == null && parent != null) {
    patriarch = parent.getPatriarch();
    parent = parent.getParent();
  }
  if(patriarch == null) {
    throw new IllegalStateException("Could not find a patriarch for a HSSPicture");
  }
  InternalWorkbook iwb = patriarch.getSheet().getWorkbook().getWorkbook();
  EscherBSERecord bse = iwb.getBSERecord(picIdx);
  EscherBlipRecord blipRecord = bse.getBlipRecord();
  return new HSSFPictureData(blipRecord);
}

相关文章