/** * 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); }
/** * 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); }
anchor.setAnchorType(AnchorType.MOVE_DONT_RESIZE); HSSFClientAnchor pref = getPreferredSize(scaleX,scaleY);
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
anchor.setAnchorType(AnchorType.MOVE_DONT_RESIZE); HSSFClientAnchor pref = getPreferredSize(scaleX,scaleY);
/** * 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()); }
/** * 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()); }