use of org.apache.poi.sl.draw.DrawPictureShape in project poi by apache.
the class XSLFGroupShape method createPicture.
@Override
public XSLFPictureShape createPicture(PictureData pictureData) {
if (!(pictureData instanceof XSLFPictureData)) {
throw new IllegalArgumentException("pictureData needs to be of type XSLFPictureData");
}
XSLFPictureData xPictureData = (XSLFPictureData) pictureData;
PackagePart pic = xPictureData.getPackagePart();
PackageRelationship rel = getSheet().getPackagePart().addRelationship(pic.getPartName(), TargetMode.INTERNAL, XSLFRelation.IMAGES.getRelation());
XSLFPictureShape sh = getDrawing().createPicture(rel.getId());
new DrawPictureShape(sh).resize();
_shapes.add(sh);
sh.setParent(this);
return sh;
}
use of org.apache.poi.sl.draw.DrawPictureShape in project poi by apache.
the class HSLFPictureShape method afterInsert.
/**
* By default set the orininal image size
*/
@Override
protected void afterInsert(HSLFSheet sh) {
super.afterInsert(sh);
EscherBSERecord bse = getEscherBSERecord();
bse.setRef(bse.getRef() + 1);
Rectangle2D anchor = getAnchor();
if (anchor.isEmpty()) {
new DrawPictureShape(this).resize();
}
}
use of org.apache.poi.sl.draw.DrawPictureShape in project poi by apache.
the class XSLFSheet method createPicture.
@Override
public XSLFPictureShape createPicture(PictureData pictureData) {
if (!(pictureData instanceof XSLFPictureData)) {
throw new IllegalArgumentException("pictureData needs to be of type XSLFPictureData");
}
XSLFPictureData xPictureData = (XSLFPictureData) pictureData;
PackagePart pic = xPictureData.getPackagePart();
RelationPart rp = addRelation(null, XSLFRelation.IMAGES, new XSLFPictureData(pic));
XSLFPictureShape sh = getDrawing().createPicture(rp.getRelationship().getId());
new DrawPictureShape(sh).resize();
getShapes().add(sh);
sh.setParent(this);
return sh;
}
Aggregations