Wrong Hyperlink Action Type Is Returned from Paragraph Portion in Java (2629)

Hi, Im having a poblem with Theater-und Filmkunst.zip (1.7 MB) file.
There is a link with wrong action type, it return JumpSpecificSlide but it should not.

screenshot: Filmkunst.PNG (34.4 KB)

Code:

Presentation presentation = new Presentation("Theater-und Filmkunst.pptx");
ISlideCollection slides = presentation.getSlides();
ISlide slide = slides.get_Item(12);
AutoShape shape = (AutoShape) slide.getShapes().get_Item(1);
IParagraph paragraph = shape.getTextFrame().getParagraphs().get_Item(34);
IPortion portion = paragraph.getPortions().get_Item(0);
System.out.println("portion text: " + portion.getText());
IHyperlink hyperlink = portion.getPortionFormat().getEffective().getHyperlinkClick();
System.out.println("action type: " + hyperlink.getActionType());

Can you please check this?
Thanks.

@Saric,
Thank you for the issue description. I reproduced the error and received the same result. I have logged the issue in our tracking system with ID SLIDESJAVA-38509. Our development team will investigate the issue. You will be notified when it is fixed.

@Saric,
Our developers have investigated the case. As you can see in the screen.png, the initial hyperlink leads to the 6th slide (Theater in Deutschland). But when you just open the “Edit Link” menu, the PowerPoint changes the link if its text is an URL.

IHyperlink.ExternalUrl shows the link as in “Edit Link” menu, but doesn’t change it. If you need to change the link to reproduce PowerPoint’s behavior, please use the following code:

Presentation presentation = new Presentation("Filmkunst.pptx");
ISlide slide = presentation.getSlides().get_Item(12);
AutoShape shape = (AutoShape)slide.getShapes().get_Item(1);

IParagraphCollection paragraps = shape.getTextFrame().getParagraphs();
for (IParagraph paragraph : paragraps)
{
    IPortion portion = paragraph.getPortions().get_Item(0);

    IHyperlink hyperlink = portion.getPortionFormat().getEffective().getHyperlinkClick();

    if (hyperlink != null && hyperlink.getExternalUrl() != null
            && hyperlink.getActionType() != HyperlinkActionType.Hyperlink)
    {
        portion.getPortionFormat().setHyperlinkClick(new Hyperlink(hyperlink.getExternalUrl()));
    }
}
presentation.save("Filmkunst-out.pptx", SaveFormat.Pptx);

See also: Manage Hyperlinks

Hi @andrey.potapov

As can be seen on “0 - screenshot marked”, the questionable link (the last one on the last slide), we do not see as internal (red arrow - Place in This Document), but as external (blue arrow - Existing File or Web Page). In addition to that, the hover effect does not show “cloud” that follow the link to the slide with the combination “Ctrl + Click” (as in the screenshot you attached), and from the content of the link itself it can be seen that it is an image (so external source).

If you look at “1 - screenshot (external link)”, “2 - screenshot (external to internal)” and “3 - screenshot (internal link)”, the third link from the bottom (with whitespace before and after content) is also an external link - Existing File or Web Page (first image). In order to make that link an internal link to a slide, we must select another category - Place in This Document (second picture). After the operation is completed, the content of the link is changed to the name of the slide, and using the combination “Ctrl + Click” leads to the given slide (third link).

Finally, the code you attached, when applied to the result has the same action type, “JumpSpecificSlide”, instead of “Hyperlink”.

Best regards,
Nenad

0 - screenshot marked.JPG (307.4 KB)

1 - screenshot (external link).JPG (248.6 KB)

2 - screenshot (external to internal).JPG (261.1 KB)

3 - screenshot (internal link).JPG (289.3 KB)

@zpredojevic,
Thank you for the message. I’ve forwarded it to our developers.