Insert Hyperlink into PowerPoint Presentation in C#

Hyperlink, which replaces large amounts of information that is related without occupying much space, is frequently used in our Word, PDF, PPT document so as to make it viewed as concise as possible. In this article, we’re focusing on how to insert hyperlink into PPT presentation slide via Spire.Presentation.

Using Spire.Presentation component, you can not only create hyperlink that redirects to a web page, an e-mail address, another slide from text, picture and shape, but also set hyperlink format and position to perfectly match the PPT page. For instance, if you want to create a hypertext link, the core codes would be as follows.

Step 1: New a PPT presentation document.

[C#]
Presentation presentation = new Presentation();

Step 2: Append a new shape and set the position (where you want hyperlink to be showed), color and style of the shape.

[C#]
IAutoShape shape = presentation.Slides[0].Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(100, 100, 150, 50));
            shape.Slide.Timeline.MainSequence.AddEffect(shape, AnimationEffectType.Zoom);
shape.Fill.FillType = FillFormatType.Solid;
            shape.Fill.SolidColor.Color = Color.LightGreen;
            shape.ShapeStyle.LineColor.Color = Color.White;

Step 3: Add text on the shape and create a hyperlink on it.

[C#]
shape.TextFrame.Text = "E-iceblue";
ClickHyperlink hyperlink = new ClickHyperlink("http://www.e-iceblue.com");
            shape.Click = hyperlink;            
            shape.TextFrame.TextRange.ClickAction = hyperlink;

Step 4: Save the document as .pptx file.

[C#]
presentation.SaveToFile("hyperlink.pptx", FileFormat.Pptx2010);
            System.Diagnostics.Process.Start("hyperlink.pptx");
[VB.NET]
Dim presentation As New Presentation()

Dim shape As IAutoShape = presentation.Slides(0).Shapes.AppendShape(ShapeType.Rectangle, New RectangleF(100, 100, 150, 50))
shape.Slide.Timeline.MainSequence.AddEffect(shape, AnimationEffectType.Zoom)
shape.Fill.FillType = FillFormatType.Solid
shape.Fill.SolidColor.Color = Color.LightGreen
shape.ShapeStyle.LineColor.Color = Color.White

shape.TextFrame.Text = "E-iceblue"
Dim hyperlink As New ClickHyperlink("http://www.e-iceblue.com")
shape.Click = hyperlink
shape.TextFrame.TextRange.ClickAction = hyperlink

presentation.SaveToFile("hyperlink.pptx", FileFormat.Pptx2010)
System.Diagnostics.Process.Start("hyperlink.pptx")

Targeted effect:

Insert Hyperlink into PPT Presentation