Manage Hyperlinks

To add a hyperlink in a presentation on the presentation level:

  1. Create an instance of the Presentation class and access the desired presentation.
  2. Add an AutoShape of Rectangle type using AddAutoShape method exposed by Shapes object.
  3. Add hyperlink.
  4. Save the presentation as a PPTX file.

To remove hyperlinks from a presentation on the presentation level:

  1. Create an instance of the Presentation class and access the desired presentation.
  2. Remove the hyperlinks in the presentation on the presentation level by accessing IPresentation.HyperlinkQueries and calling the RemoveAllHyperlinks() method.
  3. Apply a slide transition effect on a slide.
  4. Write the modified presentation as a PPTX file.

A new property ColorSource has been added to IHyperlink interface and Hyperlink class.

It allows to get or set the source of hyperlink color, which could be obtained either from slide/presentation styles or corresponding PortionFormat properties. This is a new feature of PowerPoint 2019 and any changes made to this property will take affect only in PowerPoint 2019 or higher versions.

The code snippet below shows a sample of adding two hyperlinks with different colors to the same slide:

Hyperlink class changed to be mutable. Now it is possible to change values of the following properties which were read-only before:

The code snippet below shows adding a hyperlink to the slide and editing its tooltip later:

Supported Properties in IHyperlinkQueries

The IHyperlinkQueries class can be accessed from the presentation, slide and text frame that the hyperlink is defined for.

The IHyperlinkQueries class supports the following methods and properties.