@Override public boolean equals(Object o) { if (o == null || !(o instanceof XSSFClientAnchor)) return false; XSSFClientAnchor anchor = (XSSFClientAnchor) o; return getDx1() == anchor.getDx1() && getDx2() == anchor.getDx2() && getDy1() == anchor.getDy1() && getDy2() == anchor.getDy2() && getCol1() == anchor.getCol1() && getCol2() == anchor.getCol2() && getRow1() == anchor.getRow1() && getRow2() == anchor.getRow2() ; }
private CTTransform2D createXfrm(XSSFClientAnchor anchor) { CTTransform2D xfrm = CTTransform2D.Factory.newInstance(); CTPoint2D off = xfrm.addNewOff(); off.setX(anchor.getDx1()); off.setY(anchor.getDy1()); XSSFSheet sheet = getSheet(); double widthPx = 0; for (int col = anchor.getCol1(); col < anchor.getCol2(); col++) { widthPx += sheet.getColumnWidthInPixels(col); } double heightPx = 0; for (int row = anchor.getRow1(); row < anchor.getRow2(); row++) { heightPx += ImageUtils.getRowHeightInPixels(sheet, row); } long width = Units.pixelToEMU((int) widthPx); long height = Units.pixelToEMU((int) heightPx); CTPositiveSize2D ext = xfrm.addNewExt(); ext.setCx(width - anchor.getDx1() + anchor.getDx2()); ext.setCy(height - anchor.getDy1() + anchor.getDy2()); // TODO: handle vflip/hflip return xfrm; }
int dy1Pixels = ca.getDy1() / Units.EMU_PER_PIXEL; int dx2Pixels = ca.getDx2() / Units.EMU_PER_PIXEL; int dy2Pixels = ca.getDy2() / Units.EMU_PER_PIXEL;
XSSFDrawing dp = wb.getSheetAt(0).createDrawingPatriarch(); List<XSSFShape> pics = dp.getShapes(); XSSFPicture inpPic = (XSSFPicture)pics.get(0); XSSFClientAnchor clientAnchor = inpPic.getClientAnchor(); System.out.println("col1: " + clientAnchor.getCol1() + ", col2: " + clientAnchor.getCol2() + ", row1: " + clientAnchor.getRow1() + ", row2: " + clientAnchor.getRow2()); System.out.println("x1: " + clientAnchor.getDx1() + ", x2: " + clientAnchor.getDx2() + ", y1: " + clientAnchor.getDy1() + ", y2: " + clientAnchor.getDy2());
@Override public boolean equals(Object o) { if (o == null || !(o instanceof XSSFClientAnchor)) return false; XSSFClientAnchor anchor = (XSSFClientAnchor) o; return getDx1() == anchor.getDx1() && getDx2() == anchor.getDx2() && getDy1() == anchor.getDy1() && getDy2() == anchor.getDy2() && getCol1() == anchor.getCol1() && getCol2() == anchor.getCol2() && getRow1() == anchor.getRow1() && getRow2() == anchor.getRow2() ; }
private CTTransform2D createXfrm(XSSFClientAnchor anchor) { CTTransform2D xfrm = CTTransform2D.Factory.newInstance(); CTPoint2D off = xfrm.addNewOff(); off.setX(anchor.getDx1()); off.setY(anchor.getDy1()); XSSFSheet sheet = getSheet(); double widthPx = 0; for (int col = anchor.getCol1(); col < anchor.getCol2(); col++) { widthPx += sheet.getColumnWidthInPixels(col); } double heightPx = 0; for (int row = anchor.getRow1(); row < anchor.getRow2(); row++) { heightPx += ImageUtils.getRowHeightInPixels(sheet, row); } long width = Units.pixelToEMU((int) widthPx); long height = Units.pixelToEMU((int) heightPx); CTPositiveSize2D ext = xfrm.addNewExt(); ext.setCx(width - anchor.getDx1() + anchor.getDx2()); ext.setCy(height - anchor.getDy1() + anchor.getDy2()); // TODO: handle vflip/hflip return xfrm; }
int dy1Pixels = ca.getDy1() / Units.EMU_PER_PIXEL; int dx2Pixels = ca.getDx2() / Units.EMU_PER_PIXEL; int dy2Pixels = ca.getDy2() / Units.EMU_PER_PIXEL;