Unexpected Error when Removing and Adding Text Portions in PPT in Java

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

Hi Zeljko,


Thank you for posting.

I have observed your comments and worked with the presentation file shared by you. I have been able to reproduce the specified issue. A ticket with ID SLIDESJAVA-35171 has been logged in our issue tracking system to further investigate and resolve the issue.This thread has been linked with the issue so that you may be automatically notified once the issue will be resolved.

We are sorry for your inconvenience,

Hi,


I am not able to reproduce this issue with Aspose.Slides for Java 16.3.0. Can you confirm it’s fixed at your side?

Thanks,
Zeljko

Hi Zeljko,


Thank you for sharing your findings with us.

I have observed your comments and like to share with you that the exception of Unexpected error has been fixed but we have found out that saved presentation loses SmartArt data, that is why the issue is not marked as resolved. We will share a notification with you as soon as the issue will be fixed.

Best Regards,

Hi,


I have another presentation with this issue (now using Aspose.Slides for Java 16.6.0).

Regards,
Zeljko

Hi Zeljko,


I have observed the presentation file shared by you. I have linked the presentation with associated issue. We will share the feedback with you as soon as the issue will be fixed

We are sorry for your inconvenience,

The issues you found earlier (filed as SLIDESJAVA-35171) have been fixed in Aspose.Slides for Java 24.10 (JAR).
You can check all fixes on the Release Notes page.
You can also find the latest version of our library on the Product Download page.