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

Free Support Forum - aspose.com

Add mulitple hyperlinks in Portion

How would I add multiple hyperlinks to a portion of a table? I’m able to do so in Powerpoint with line fee and would like to do the same. Below is the code for two texts with line feed but not able to do so with two hyperlinks. I put a \v for the text and same for the hyperlink but the end result it error when opening saved ppt. Thanks

        // Instantiate a Presentation class that represents a PPTX
        Presentation pptxPresentation = new Presentation();

        // Get first slide
        ISlide slide = pptxPresentation.Slides[0];

        // Add an AutoShape of Rectangle Type
        IShape pptxShape = slide.Shapes.AddAutoShape(ShapeType.Rectangle, 150, 150, 150, 50);

        // Cast the shape to AutoShape
        IAutoShape pptxAutoShape = (IAutoShape)pptxShape;

        // Access ITextFrame associated with the AutoShape

        ITextFrame ITextFrame = pptxAutoShape.TextFrame;

        // Add 1st url text with line feed and 2nd url text
        ITextFrame.Paragraphs[0].Portions[0].Text = "Aspose.Slides" + "\v" + "Yahoo.com";

		// Set hyperlinks here with line fee between 1st and 2nd hyperlink but doesn't work
		IHyperlinkManager HypMan = ITextFrame.Paragraphs[0].Portions[0].PortionFormat.HyperlinkManager;
        HypMan.SetExternalHyperlinkClick("http://www.aspose.com" + "\v" + "http://www.yahoo.com");

I can set the Portions.[0].Text fine with linefeed “\v” but not so with SetExternalHyperlinkClick. Seems like I have to use SetExternalHyperlinkClick without linefee “\v” but not sure how I can set the second hyperlink for “Yahoo.com” in this case. Thanks again.


I have observed your requirements and like to share that you can only set one hyperlink for one portion of text. In order to have multiple hyperlinks, one need to have multiple portions of text. I hope the shared elaboration will be helpful.