Create and Format Links
In a presentation, you can create an internal link, from one slide to another slide, or an external link to a location outside of the presentation.
Create an Internal Link
To create a link from one slide to another slide, append an object of the mlreportgen.ppt.InternalLink class to a paragraph in the source slide. Use
the InternalLink object properties to specify the target slide and the
link text. You can specify the target slide by using the target slide name or
index.
Link to Slide Using the Target Slide Name
This example links to a slide using an mlreportgen.ppt.InternalLink object that specifies the target slide name.
Create the presentation.
import mlreportgen.ppt.* ppt = Presentation("myPresentation1.pptx"); open(ppt);
Add a slide to the presentation.
slide1 = add(ppt,"Title and Content");Choose a name to identify the target slide.
targetSlideName = "myTargetSlide"; Create a paragraph. Create an InternalLink object that specifies the target slide by name and append it to the paragraph.
p = Paragraph("This is a link to the slide with the name ");
linkObj = InternalLink(targetSlideName,targetSlideName);
append(p,linkObj);Add the title and content to the slide.
replace(slide1,"Title","First slide"); replace(slide1,"Content",p);
Add a second slide to the presentation.
slide2 = add(ppt,"Title and Content"); replace(slide2,"Title","Second slide");
Add the target slide to the presentation. Set the Name property of the slide to the name specified in the InternalLink object.
slide3 = add(ppt,"Title and Content"); slide3.Name = targetSlideName; replace(slide3,"Title","Third slide"); content = strcat("This is the target slide with the name ",targetSlideName); replace(slide3,"Content",content);
Close and view the presentation.
close(ppt); rptview(ppt);
Here are the generated slides:

Link to a Slide Using the Target Slide Index
This example links to a slide using an mlreportgen.ppt.InternalLink object that specifies the target slide number.
Create the presentation.
import mlreportgen.ppt.* ppt = Presentation("myPresentation2.pptx"); open(ppt);
Add a slide to the presentation.
slide1 = add(ppt,"Title and Content"); Create a paragraph. Create an InternalLink object that specifies the target slide by its index and append the object to the paragraph.
p = Paragraph("This is a link to "); link = InternalLink(3,"slide 3"); append(p,link);
Add the title and content to the slide.
replace(slide1,"Title","First slide"); replace(slide1,"Content",p);
Add a slide 2 to the presentation.
slide2 = add(ppt,"Title and Content"); replace(slide2,"Title","Second slide");
Add the target slide, slide 3, to the presentation.
slide3 = add(ppt,"Title and Content"); replace(slide3,"Title","Third slide"); replace(slide3,"Content","This is the target slide");
Close and view the presentation.
close(ppt); rptview(ppt);
Here are the generated slides:

Create an External Link
To create a link to a location outside of a presentation, append an object of the
mlreportgen.ppt.ExternalLink class to a paragraph in a slide. Use the
ExternalLink object properties to specify the link text, and the full
URL of the link target.
Link from a Slide to a Website
This example uses an mlreportgen.ppt.ExternalLink object to link from a slide to a website.
import mlreportgen.ppt.* ppt = Presentation("myPresentation3.pptx"); open(ppt); add(ppt,"Title and Content"); p = Paragraph("This is a link to the "); link = ExternalLink("https://www.mathworks.com","MathWorks site"); append(p,link); replace(ppt,"Content",p); close(ppt); rptview(ppt);
Here is the generated slide:

Format an Internal or External Link
You can customize the appearance of the link text by using the format properties of an
mlreportgen.ppt.InternalLink or
mlreportgen.ppt.ExternalLink object or by adding format objects to
the Style property of an InternalLink or
ExternalLink object. See mlreportgen.ppt.InternalLink and mlreportgen.ppt.ExternalLink for the properties that specify the link text
appearance.
Customize the Appearance of the Link Text
This example specifies italic link text for a link from a slide to a website.
import mlreportgen.ppt.* ppt = Presentation("myPresentation4.pptx"); open(ppt); add(ppt,"Title and Content"); p = Paragraph("This is a link to the "); link = ExternalLink("https://www.mathworks.com","MathWorks site"); link.Italic = true; append(p,link); replace(ppt,"Content",p); close(ppt); rptview(ppt);
Here is the generated slide:
