Hi,
I am trying to add an image to a slide. And it’s not working…can you please help. here is the code:
I am evaluating this product.
public String index() {
String dest = “C:/kishore/Aspose/generated/”;
Presentation pres = new Presentation(dest + "headerTest.pptx");
pres.getHeaderFooterManager().setAllFootersVisibility(true);
IMasterNotesSlide masterNotesSlide = pres.getMasterNotesSlideManager().getMasterNotesSlide();
if (null != masterNotesSlide) {
updateHeaderFooterText(masterNotesSlide, pres);
}
pres.save(dest + "Master2BG.pptx", SaveFormat.Pptx);
return "Hello world!!!";
}
public static void updateHeaderFooterText(IBaseSlide master, Presentation pres) {
for (IShape shape : master.getShapes()) {
if (shape.getPlaceholder() != null) {
if (shape.getPlaceholder().getType() == PlaceholderType.Footer) {
((IAutoShape) shape).getFillFormat().setFillType(FillType.Picture);
((IAutoShape) shape).getFillFormat().getPictureFillFormat().setPictureFillMode(PictureFillMode.Stretch);
IPPImage footer_image = null;
try {
footer_image = pres.getImages().addImage(new FileInputStream(new File("C:/kishore/Aspose/Desert-1.jpg")));
} catch (IOException e) {
System.out.println(e.getMessage());
}
((IAutoShape) shape).getFillFormat().getPictureFillFormat().getPicture().setImage(footer_image);
}
}
}
}