Hi,
In the attached presentation, on Master Slide #4 there’s a portion which contains text “MASTER STAMP”. I tried to remove it via code and add new portion to its place but I got the exception mentioned in subject of the thread.
Here’s the code I used:
String presentationPath = "PRMEWebinarSupplyChain7June2013.ppt";
InputStream stream = new FileInputStream(presentationPath);
Presentation presentation = new Presentation(stream);
stream.close();
IMasterSlide slide = presentation.getMasters().get_Item(3);
IAutoShape shape = (IAutoShape) slide.getShapes().get_Item(2);
IPortionCollection portions = shape.getTextFrame().getParagraphs().get_Item(0).getPortions();
System.out.println(portions.get_Item(0).getText());
// Remove portion with text “MASTER STAMP”
portions.removeAt(0);
IPortion portion = new Portion("New portion text");
portions.insert(0, portion);
OutputStream outputStream = new FileOutputStream(
new File("PRMEWebinarSupplyChain7June2013-aspose.ppt"));
presentation.save(outputStream, SaveFormat.Ppt);
outputStream.close();
Thanks,
Zeljko