We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Hyperlink to last slide

Hi,


How can I create a hyperlink on portion text which links to the first or the last slide of presentation?

I know I can do it like this, but that’s not exactly what I want:

ISlide slide = /* code to get the first slide /
IPortion portion = / code to get the portion which I wan’t to create a link on */
IHyperlinkManager hyperlinkManager = portion.getPortionFormat().getHyperlinkManager();
hyperlinkManager.setInternalHyperlinkClick(slide);

This code will link exactly to Slide #1, not “the first slide”. So if I add a slide before the first slide, this won’t work as it should.

Please see the screenshot to understand better what I need.

Thanks,
Zeljko

Hi Zeljko,

I have observed the requirements shared by you and regret to share that at present the requested support for setting internal hyperlink is unavailable in Aspose.Slides for Java. An issue with ID SLIDESJAVA-35123 has been created in our issue tracking system to further investigate the possibility of implementing the requested support. This thread has been linked with the issue so that you may be automatically notified once the support will be available.

Many Thanks,

@Zeljko,
Please, use the following code snippet:

Presentation pres = new Presentation();
try {
    IAutoShape shape1 = pres.getSlides().get_Item(0).getShapes().addAutoShape(ShapeType.Rectangle, 100, 100, 600, 50, false);
    shape1.addTextFrame("Aspose: File Format APIs");
    IPortionFormat portionFormat = shape1.getTextFrame().getParagraphs().get_Item(0).getPortions().get_Item(0).getPortionFormat();

    portionFormat.setHyperlinkClick(Hyperlink.getFirstSlide());

    pres.save("hyperlink-out.pptx", SaveFormat.Pptx);
} finally {
    if (pres != null) pres.dispose();
}

More examples: Manage Hyperlinks
API Reference: IPortionFormat interface, Hyperlink class