Changing Hyperlink Address Changes the Text when Saved as PPTX in Java

Hi,

I’m using Aspose.Slides 22.9, when I change a hyperlink address and save the files as pptx, the text of that hyperlink changes to the new address (instead of keeping the original text). This doesn’t happen when saving as ppt.

    IPresentation presentation = com.aspose.slides.PresentationFactory.getInstance().readPresentation("/path/to/presentation/with/hyperlinks.pptx");

    for (ISlide slide : presentation.getSlides()) {
        for (ITextFrame frame : SlideUtil.getAllTextBoxes(slide)) {
            for (IParagraph paragraph : frame.getParagraphs()) {
                for (IPortion portion : paragraph.getPortions()) {
                    portion.getPortionFormat().getHyperlinkManager().setExternalHyperlinkClick("http://www.example.com");
                }
            }
        }
    }

    presentation.save("/path/to/output.pptx");

Can you please look at this?

I’ve attached input and output files.
input_and_output.7z (42.6 KB)

Thanks

@texben,
Thank you for reporting the issue.

I’ve reproduced the problem with changing the hyperlink in the presentation and added a ticket with ID SLIDESJAVA-38962 to our issue-tracking system. We apologize for any inconvenience. Our development team will investigate the case. You will be notified when a new release of Aspose.Slides with a fix is published.

It would be great if you could share the following additional information:

  • OS version on which the code was executed
  • JDK version in your app

We will then also test the fix in an environment similar to yours.

OS version is RHEL 7.6
JDK version is 1.8

Can you give us an update on the status of this issue?

@texben,
I’ve requested plans for the issue from our development team. We will let you know soon.

The issues you found earlier (filed as SLIDESJAVA-38962) have been fixed in Aspose.Slides for Java 23.2 (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.

@texben,
Please use the following code snippet:

IPresentation presentation = com.aspose.slides.PresentationFactory.getInstance().readPresentation("input.pptx");

for (ISlide slide : presentation.getSlides()) {
    for (ITextFrame frame : SlideUtil.getAllTextBoxes(slide)) {
        for (IParagraph paragraph : frame.getParagraphs()) {
            for (IPortion portion : paragraph.getPortions()) {
                String text = portion.getText();
                portion.getPortionFormat().getHyperlinkManager().setExternalHyperlinkClick("http://www.example.com");
                portion.setText(text);
            }
        }
    }
}

presentation.save("output.pptx", SaveFormat.Pptx);