How to remove the hyperlink on a slide in the presentation

In the previous topic, we discussed about how to insert hyperlink into PowerPoint presentation. In this topic, we will show you how to remove the hyperlink on a slide in the presentation by using the Spire.Presentation in C#.

Firstly, view the hyperlinks on a slide that we need to remove later.

How to remove the hyperlink on a slide in the presentation

Here comes to the steps of how to remove the hyperlinks in the PowerPoint presentation in C#.

Step 1: Create Presentation instance and load file.

Presentation ppt = new Presentation();
ppt.LoadFromFile("Sample.pptx", FileFormat.Pptx2010);

Step 2: Get the shape and its text with hyperlink.

IAutoShape shape = ppt.Slides[0].Shapes[1] as IAutoShape;

Step 3: Set the ClickAction property into null to remove the hyperlink.

shape.TextFrame.TextRange.ClickAction = null;

Step 4: Save the document to file.

ppt.SaveToFile("Result.pptx", FileFormat.Pptx2010);

Effective screenshot after removing the first hyperlink:

How to remove the hyperlink on a slide in the presentation

Full codes:

using Spire.Presentation;
namespace RemoveHyperlink
{

    class Program
    {

        static void Main(string[] args)
        {
            Presentation ppt = new Presentation();
            ppt.LoadFromFile("Sample.pptx", FileFormat.Pptx2010);

            IAutoShape shape = ppt.Slides[0].Shapes[1] as IAutoShape;
            shape.TextFrame.TextRange.ClickAction = null;

            ppt.SaveToFile("Result.pptx", FileFormat.Pptx2010);

        }
    }
}