@Override public void setPositionInPoints(final double points) { setPosition(Units.toEMU(points)); }
@Override public double getPositionInPoints() { return Units.toPoints(getPosition()); }
/** * @param columnWidth specified in 256ths of a standard character * @return equivalent EMUs */ public static int columnWidthToEMU(int columnWidth) { return charactersToEMU(columnWidth / 256d); }
int c = cell.getCol(); int cw = Units.columnWidthToEMU(sheet.getColumnWidth(c)); cw = Units.columnWidthToEMU(sheet.getColumnWidth(c)); wPos += cw; c2.setColOff(cw - (wPos - w)); int rh = Units.toEMU(getRowHeight(sheet, r)); rh = Units.toEMU(getRowHeight(sheet, r)); hPos += rh;
@Override public Dimension getImageDimensionInPixels() { Dimension dim = getImageDimension(); return new Dimension( Units.pointsToPixel(dim.getWidth()), Units.pointsToPixel(dim.getHeight()) ); }
public ImageHeaderBitmap(byte data[], int offset) { BufferedImage img = null; try { img = ImageIO.read(new ByteArrayInputStream(data, offset, data.length-offset)); } catch (IOException e) { LOG.log(POILogger.WARN, "Can't determine image dimensions", e); } // set dummy size, in case of dummy dimension can't be set size = (img == null) ? new Dimension(200,200) : new Dimension( (int)Units.pixelToPoints(img.getWidth()), (int)Units.pixelToPoints(img.getHeight()) ); }
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 c = cell.getCol(); int cw = Units.columnWidthToEMU(sheet.getColumnWidth(c)); cw = Units.columnWidthToEMU(sheet.getColumnWidth(c)); wPos += cw; c2.setColOff(cw - (wPos - w)); int rh = Units.toEMU(getRowHeight(sheet, r)); rh = Units.toEMU(getRowHeight(sheet, r)); hPos += rh;
@Override public Dimension getImageDimensionInPixels() { Dimension dim = getImageDimension(); return new Dimension( Units.pointsToPixel(dim.getWidth()), Units.pointsToPixel(dim.getHeight()) ); } }
@Override public Dimension getImageDimension() { try { BufferedImage bi = ImageIO.read(new ByteArrayInputStream(getData())); return new Dimension( (int)Units.pixelToPoints(bi.getWidth()), (int)Units.pixelToPoints(bi.getHeight()) ); } catch (IOException e) { return new Dimension(200,200); } } }
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; }
public void setHeight(double height){ _row.setH(Units.toEMU(height)); }
public double getHeight(){ return Units.toPoints(_row.getH()); }
@Override public Dimension getImageDimensionInPixels() { Dimension dim = getImageDimension(); return new Dimension( Units.pointsToPixel(dim.getWidth()), Units.pointsToPixel(dim.getHeight()) ); }
public ImageHeaderBitmap(byte data[], int offset) { BufferedImage img = null; try { img = ImageIO.read(new ByteArrayInputStream(data, offset, data.length-offset)); } catch (IOException e) { LOG.log(POILogger.WARN, "Can't determine image dimensions", e); } // set dummy size, in case of dummy dimension can't be set size = (img == null) ? new Dimension(200,200) : new Dimension( (int)Units.pixelToPoints(img.getWidth()), (int)Units.pixelToPoints(img.getHeight()) ); }
/** * @param columnWidth specified in 256ths of a standard character * @return equivalent EMUs */ public static int columnWidthToEMU(int columnWidth) { return charactersToEMU(columnWidth / 256d); }
public static double getRowHeightInPixels(Sheet sheet, int rowNum) { Row r = sheet.getRow(rowNum); double points = (r == null) ? sheet.getDefaultRowHeightInPoints() : r.getHeightInPoints(); return Units.toEMU(points)/(double)EMU_PER_PIXEL; } }
@Override public Dimension getDimension() { int width = 0, height = 0; if (image != null) { Dimension dim = image.getSize(); width = Units.pointsToPixel(dim.getWidth()); // keep aspect ratio for height height = Units.pointsToPixel(dim.getHeight()); } return new Dimension(width, height); }