int dy2 = (int)(Units.EMU_PER_PIXEL * (ch - deltaH)); anchor.setRow2(row2); anchor.setDy2(dy2);
anchor.setDy2(pref.getDy2());
/** * Reset the image to the original size. * <p> * Please note, that this method works correctly only for workbooks * with the default font size (Calibri 11pt for .xlsx). * 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. */ @Override public void resize(double scale){ XSSFClientAnchor anchor = getClientAnchor(); XSSFClientAnchor pref = getPreferredSize(scale); if (anchor == null || pref == null) { logger.log(POILogger.WARN, "picture is not anchored via client anchor - ignoring resize call"); return; } int row2 = anchor.getRow1() + (pref.getRow2() - pref.getRow1()); int col2 = anchor.getCol1() + (pref.getCol2() - pref.getCol1()); anchor.setCol2(col2); anchor.setDx1(0); anchor.setDx2(pref.getDx2()); anchor.setRow2(row2); anchor.setDy1(0); anchor.setDy2(pref.getDy2()); }
anchor.setDx2(width * XSSFShape.EMU_PER_PIXEL); anchor.setDy1(0 * XSSFShape.EMU_PER_PIXEL); anchor.setDy2(height * XSSFShape.EMU_PER_PIXEL); drawing.createPicture(anchor, pictureIndex); }finally{ anchor.setDx2(width * XSSFShape.EMU_PER_PIXEL); anchor.setDy1(0 * XSSFShape.EMU_PER_PIXEL); anchor.setDy2(height * XSSFShape.EMU_PER_PIXEL); drawing.createPicture(anchor, pictureIndex); }finally{ anchor.setDx2(width * XSSFShape.EMU_PER_PIXEL); anchor.setDy1(0 * XSSFShape.EMU_PER_PIXEL); anchor.setDy2(height * XSSFShape.EMU_PER_PIXEL); drawing.createPicture(anchor, pictureIndex); }finally{ anchor.setDx2(width * XSSFShape.EMU_PER_PIXEL); anchor.setDy1(0 * XSSFShape.EMU_PER_PIXEL); anchor.setDy2(height * XSSFShape.EMU_PER_PIXEL); drawing.createPicture(anchor, pictureIndex); }finally{
anchor.setDx2(width * XSSFShape.EMU_PER_PIXEL); anchor.setDy1(topMargin * XSSFShape.EMU_PER_PIXEL); anchor.setDy2(height * XSSFShape.EMU_PER_PIXEL); drawing.createPicture(anchor, pictureIndex); }finally{ anchor.setDx2(width * XSSFShape.EMU_PER_PIXEL); anchor.setDy1(topMargin * XSSFShape.EMU_PER_PIXEL); anchor.setDy2(height * XSSFShape.EMU_PER_PIXEL); drawing.createPicture(anchor, pictureIndex); }finally{
anchor.setDx2(width * XSSFShape.EMU_PER_PIXEL); anchor.setDy1(topMargin * XSSFShape.EMU_PER_PIXEL); anchor.setDy2(height * XSSFShape.EMU_PER_PIXEL); drawing.createPicture(anchor, pictureIndex); }finally{ anchor.setDx2(width * XSSFShape.EMU_PER_PIXEL); anchor.setDy1(topMargin * XSSFShape.EMU_PER_PIXEL); anchor.setDy2(height * XSSFShape.EMU_PER_PIXEL); drawing.createPicture(anchor, pictureIndex); }finally{
anchor.setDx2(width * XSSFShape.EMU_PER_PIXEL); anchor.setDy1(0 * XSSFShape.EMU_PER_PIXEL); anchor.setDy2(height * XSSFShape.EMU_PER_PIXEL); drawing.createPicture(anchor, pictureIndex); }finally{ anchor.setDx2(width * XSSFShape.EMU_PER_PIXEL); anchor.setDy1(0 * XSSFShape.EMU_PER_PIXEL); anchor.setDy2(height * XSSFShape.EMU_PER_PIXEL); drawing.createPicture(anchor, pictureIndex); }finally{ anchor.setDx2(width * XSSFShape.EMU_PER_PIXEL); anchor.setDy1(0 * XSSFShape.EMU_PER_PIXEL); anchor.setDy2(height * XSSFShape.EMU_PER_PIXEL); drawing.createPicture(anchor, pictureIndex); }finally{ anchor.setDx2(width * XSSFShape.EMU_PER_PIXEL); anchor.setDy1(0 * XSSFShape.EMU_PER_PIXEL); anchor.setDy2(height * XSSFShape.EMU_PER_PIXEL); drawing.createPicture(anchor, pictureIndex); }finally{
anchor.setDx2(width * XSSFShape.EMU_PER_PIXEL); anchor.setDy1(topMargin * XSSFShape.EMU_PER_PIXEL); anchor.setDy2(height * XSSFShape.EMU_PER_PIXEL); drawing.createPicture(anchor, pictureIndex); }finally{ anchor.setDx2(width * XSSFShape.EMU_PER_PIXEL); anchor.setDy1(topMargin * XSSFShape.EMU_PER_PIXEL); anchor.setDy2(height * XSSFShape.EMU_PER_PIXEL); drawing.createPicture(anchor, pictureIndex); }finally{
anchor.setDx2(width * XSSFShape.EMU_PER_PIXEL); anchor.setDy1(topMargin * XSSFShape.EMU_PER_PIXEL); anchor.setDy2(height * XSSFShape.EMU_PER_PIXEL); drawing.createPicture(anchor, pictureIndex); }finally{ anchor.setDx2(width * XSSFShape.EMU_PER_PIXEL); anchor.setDy1(topMargin * XSSFShape.EMU_PER_PIXEL); anchor.setDy2(height * XSSFShape.EMU_PER_PIXEL); drawing.createPicture(anchor, pictureIndex); }finally{
anchor.setDy2(dy2);
int dy2 = (int)(Units.EMU_PER_PIXEL * (ch - deltaH)); anchor.setRow2(row2); anchor.setDy2(dy2);
/** * Reset the image to the original size. * <p> * Please note, that this method works correctly only for workbooks * with the default font size (Calibri 11pt for .xlsx). * 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){ XSSFClientAnchor anchor = (XSSFClientAnchor)getAnchor(); XSSFClientAnchor pref = getPreferredSize(scale); int row2 = anchor.getRow1() + (pref.getRow2() - pref.getRow1()); int col2 = anchor.getCol1() + (pref.getCol2() - pref.getCol1()); anchor.setCol2(col2); anchor.setDx1(0); anchor.setDx2(pref.getDx2()); anchor.setRow2(row2); anchor.setDy1(0); anchor.setDy2(pref.getDy2()); }
anchor.setDy2(pref.getDy2());
/** * Reset the image to the original size. * <p> * Please note, that this method works correctly only for workbooks * with the default font size (Calibri 11pt for .xlsx). * 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. */ @Override public void resize(double scale){ XSSFClientAnchor anchor = getClientAnchor(); XSSFClientAnchor pref = getPreferredSize(scale); if (anchor == null || pref == null) { logger.log(POILogger.WARN, "picture is not anchored via client anchor - ignoring resize call"); return; } int row2 = anchor.getRow1() + (pref.getRow2() - pref.getRow1()); int col2 = anchor.getCol1() + (pref.getCol2() - pref.getCol1()); anchor.setCol2(col2); anchor.setDx1(0); anchor.setDx2(pref.getDx2()); anchor.setRow2(row2); anchor.setDy1(0); anchor.setDy2(pref.getDy2()); }