Hi,
Hi Ravindu,
Hi,
Hi Ravindu,
I have observed your comments and like to request you to please try using following sample code on your end to serve the purpose, and then share your kind feedback with us.
Presentation pres = new Presentation("D:\\replacepic.pptx");
for (ISlide slide : pres.getSlides())
{
for (IShape shape : slide.getShapes())
{
if (shape instanceof PictureFrame)
{
IPictureFrame pf = (IPictureFrame) shape;
if (pf.getAlternativeText().compareTo("test") == 0)
{
IPPImage imgx = null;
try
{
imgx = pres.getImages().addImage(new FileInputStream(new File("C:\\test.JPG")));
IPPImage oldImage = pf.getPictureFormat().getPicture().getImage();
oldImage.replaceImage(imgx);
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
}
}
}
//Write the PPTX file to disk
pres.save("D:\\test.pptx", SaveFormat.Pptx);
A picture is contained within a picture frame, which is basically a shape. A shape could be distinguished by the AlternativeText of that shape, as explained in this documentation article. Then the image is being replaced as in the code sample above. I have also attached the sample presentation for your kind reference.
I hope this will be helpful. Please share if I may help you further in this regard.
Best Regards,
Hi,
Hi Ravindu,
The issues you have found earlier (filed as SLIDESJAVA-35205) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.