Add Hyperlinks to SmartArt Nodes in PowerPoint in C#, VB.NET

This article demonstrates how to add hyperlinks to SmartArt Nodes in a PowerPoint document in C# and VB.NET using Spire.Presentation for .NET.

C#
using Spire.Presentation;
using Spire.Presentation.Diagrams;

namespace SmartArt
{
    class Program
    {
        static void Main(string[] args)
        {
            //Create a Presentation instance
            Presentation ppt = new Presentation();
            //Load the PowerPoint document
            ppt.LoadFromFile("SmartArt.pptx");

            //Get the first slide
            ISlide slide = ppt.Slides[0];
           
            //Get the SmartArt
            ISmartArt smartArt = slide.Shapes[0] as ISmartArt;

            //Add hyperlink to the first node of the SmartArt to link to a web page
            smartArt.Nodes[0].Click = new ClickHyperlink("https://www.e-iceblue.com");
            //Add hyperlink to the first node of the SmartArt to link to a specific slide
            smartArt.Nodes[1].Click = new ClickHyperlink(ppt.Slides[1]);

            //Save the result document
            ppt.SaveToFile("Result.pptx", FileFormat.Pptx2013);
        }
    }
}
VB.NET
Imports Spire.Presentation
Imports Spire.Presentation.Diagrams

Namespace SmartArt
    Class Program
        Private Shared Sub Main(ByVal args As String())
            Dim ppt As Presentation = New Presentation()
            ppt.LoadFromFile("SmartArt.pptx")
            Dim slide As ISlide = ppt.Slides(0)
            Dim smartArt As ISmartArt = TryCast(slide.Shapes(0), ISmartArt)
            smartArt.Nodes(0).Click = New ClickHyperlink("https://www.e-iceblue.com")
            smartArt.Nodes(1).Click = New ClickHyperlink(ppt.Slides(1))
            ppt.SaveToFile("Result.pptx", FileFormat.Pptx2013)
        End Sub
    End Class
End Namespace

Output:

Add Hyperlinks to SmartArt Nodes in PowerPoint in C#, VB.NET