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

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

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

HSSFPicture.getPreferredSize介绍

[英]Calculate the preferred size for this picture.
[中]计算此图片的首选大小。

代码示例

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

/**
 * Calculate the preferred size for this picture.
 *
 * @param scale the amount by which image dimensions are multiplied relative to the original size.
 * @return HSSFClientAnchor with the preferred size for this image
 * @since POI 3.0.2
 */
public HSSFClientAnchor getPreferredSize(double scale){
  return getPreferredSize(scale, scale);
}

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

/**
 * Calculate the preferred size for this picture.
 *
 * @return HSSFClientAnchor with the preferred size for this image
 * @since POI 3.0.2
 */
@Override
public HSSFClientAnchor getPreferredSize(){
  return getPreferredSize(1.0);
}

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

anchor.setAnchorType(AnchorType.MOVE_DONT_RESIZE);
HSSFClientAnchor pref = getPreferredSize(scaleX,scaleY);

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

/**
 * Calculate the preferred size for this picture.
 *
 * @param scale the amount by which image dimensions are multiplied relative to the original size.
 * @return HSSFClientAnchor with the preferred size for this image
 * @since POI 3.0.2
 */
public HSSFClientAnchor getPreferredSize(double scale){
  return getPreferredSize(scale, scale);
}

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

/**
 * Calculate the preferred size for this picture.
 *
 * @return HSSFClientAnchor with the preferred size for this image
 * @since POI 3.0.2
 */
public HSSFClientAnchor getPreferredSize(){
  return getPreferredSize(1.0);
}

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

/**
 * Calculate the preferred size for this picture.
 *
 * @return HSSFClientAnchor with the preferred size for this image
 * @since POI 3.0.2
 */
@Override
public HSSFClientAnchor getPreferredSize(){
  return getPreferredSize(1.0);
}

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

/**
 * Calculate the preferred size for this picture.
 *
 * @return HSSFClientAnchor with the preferred size for this image
 * @since POI 3.0.2
 */
public HSSFClientAnchor getPreferredSize(){
  return getPreferredSize(1.0);
}

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

anchor.setAnchorType(AnchorType.MOVE_DONT_RESIZE);
HSSFClientAnchor pref = getPreferredSize(scaleX,scaleY);

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

/**
 * Resize the image
 * <p>
 * Please note, that this method works correctly only for workbooks
 * with default font size (Arial 10pt for .xls).
 * If the default font is changed the resized image can be streched vertically or horizontally.
 * </p>
 *
 * @param scale the amount by which image dimensions are multiplied relative to the original size.
 * <code>resize(1.0)</code> sets the original size, <code>resize(0.5)</code> resize to 50% of the original,
 * <code>resize(2.0)</code> resizes to 200% of the original.
 */
public void resize(double scale){
  HSSFClientAnchor anchor = (HSSFClientAnchor)getAnchor();
  anchor.setAnchorType(2);
  HSSFClientAnchor pref = getPreferredSize(scale);
  int row2 = anchor.getRow1() + (pref.getRow2() - pref.getRow1());
  int col2 = anchor.getCol1() + (pref.getCol2() - pref.getCol1());
  anchor.setCol2((short)col2);
  anchor.setDx1(0);
  anchor.setDx2(pref.getDx2());
  anchor.setRow2(row2);
  anchor.setDy1(0);
  anchor.setDy2(pref.getDy2());
}

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

/**
 * Resize the image
 * <p>
 * Please note, that this method works correctly only for workbooks
 * with default font size (Arial 10pt for .xls).
 * If the default font is changed the resized image can be streched vertically or horizontally.
 * </p>
 *
 * @param scale the amount by which image dimensions are multiplied relative to the original size.
 * <code>resize(1.0)</code> sets the original size, <code>resize(0.5)</code> resize to 50% of the original,
 * <code>resize(2.0)</code> resizes to 200% of the original.
 */
public void resize(double scale){
  HSSFClientAnchor anchor = (HSSFClientAnchor)getAnchor();
  anchor.setAnchorType(2);
  HSSFClientAnchor pref = getPreferredSize(scale);
  int row2 = anchor.getRow1() + (pref.getRow2() - pref.getRow1());
  int col2 = anchor.getCol1() + (pref.getCol2() - pref.getCol1());
  anchor.setCol2((short)col2);
  anchor.setDx1(0);
  anchor.setDx2(pref.getDx2());
  anchor.setRow2(row2);
  anchor.setDy1(0);
  anchor.setDy2(pref.getDy2());
}

相关文章