Dear All,
I am a Java developer, and now developing some features related to PPTX.
My requirement is that I need to update the picture of a PictureShape with a
new picture.
Unfortunately, I could not find out the method to update the picture. The
version of the POI I am using is 3.9.
So could anybody share me your exprience on how to resolve such an issue ?
Another question, how could I send the XSLFPictureShape Backward ? Please refer
to following screenshot.
I am very grateful if could get your help!
Attached the sample code is as following,
if (shape instanceof XSLFPictureShape) {
XSLFPictureShape picShape = (XSLFPictureShape) shape;
XSLFPictureData picData = picShape.getPictureData();
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
IOUtils.copy(PptExport.class.getResourceAsStream("275713.jpg"), out);
int picIndex =
picShape.getSheet().getSlideShow().addPicture(out.toByteArray(),
picData.getPictureType());
XSLFPictureShape pic =
picShape.getSheet().createPicture(picIndex);// This is not I want, Why not
provide a method like picShape.setPicture(imageInputStream) ; ?
pic.getAnchor().setRect(picShape.getAnchor().getX(),
picShape.getAnchor().getY(), picShape.getAnchor().getWidth(),
picShape.getAnchor().getHeight());
} catch (IOException e) {
// TODO Auto-generated catch block
...
}
}
Thank you.
Best Regards,
Mikaka
undefined (24K)
<http://apache-poi.1045710.n5.nabble.com/attachment/5715447/0/undefined>
Send Backward.png (21K)
<http://apache-poi.1045710.n5.nabble.com/attachment/5715447/1/Send%20Backward.png>
--
View this message in context:
http://apache-poi.1045710.n5.nabble.com/How-to-update-the-picture-in-XSLFPictureShape-tp5715447.html
Sent from the POI - User mailing list archive at Nabble.com.