SetExternalHyperlinkClick

HyperlinkManager.SetExternalHyperlinkClick method

Set external hyperlink on click.

public IHyperlink SetExternalHyperlinkClick(string url)
ParameterTypeDescription
urlStringHyperlink URL.

Examples

The following sample code shows how to add Text Box with Hyperlink.

[C#]
// Instantiates a Presentation class that represents a PPTX
using(Presentation pptxPresentation = new Presentation()) {
  // Gets the first slide in the presentation
  ISlide slide = pptxPresentation.Slides[0];
  // Adds an AutoShape object with type set as Rectangle
  IShape pptxShape = slide.Shapes.AddAutoShape(ShapeType.Rectangle, 150, 150, 150, 50);
  // Casts the shape to AutoShape
  IAutoShape pptxAutoShape = (IAutoShape) pptxShape;
  // Accesses the ITextFrame property associated with the AutoShape
  pptxAutoShape.AddTextFrame("");
  ITextFrame textFrame = pptxAutoShape.TextFrame;
  // Adds some text to the frame
  textFrame.Paragraphs[0].Portions[0].Text = "Aspose.Slides";
  // Sets the Hyperlink for the portion text
  IHyperlinkManager HypMan = textFrame.Paragraphs[0].Portions[0].PortionFormat.HyperlinkManager;
  HypMan.SetExternalHyperlinkClick("http://www.aspose.com");
  // Saves the PPTX Presentation
  pptxPresentation.Save("hLinkPPTX_out.pptx", Aspose.Slides.Export.SaveFormat.Pptx);
}

See Also