Main Content

mlreportgen.ppt.InternalLink class

Package: mlreportgen.ppt
Superclasses: mlreportgen.ppt.Text

Hyperlink to a slide in a presentation

Description

Use an object of the mlreportgen.ppt.InternalLink class to link from one slide to another slide in a presentation.

The mlreportgen.ppt.InternalLink class is a handle class.

Class Attributes

ConstructOnLoad
true
HandleCompatible
true

For information on class attributes, see Class Attributes.

Creation

Description

internalLinkObj = mlreportgen.ppt.InternalLink() creates an empty InternalLink object.

example

internalLinkObj = mlreportgen.ppt.InternalLink(targetSlideName,linkText) creates an InternalLink object with the Target property set to targetSlideName and the Content property set to linkText.

example

internalLinkObj = mlreportgen.ppt.InternalLink(targetSlideIndex,linkText) creates an InternalLink object with the Target property set to targetSlideIndex and the Content property set to linkText.

Properties

expand all

Target slide of the hyperlink, specified as an integer, character vector, or string scalar. Use an integer to indicate the index of the target slide. Use a character vector or string scalar to indicate the name of the target slide.

Link text, specified as a character vector or string scalar.

Whether to use bold for the link text, specified as true or false. A setting of true renders text in bold.

Font family for the link text, specified as a character vector or string scalar. Specify a font that appears in the font list in Microsoft® PowerPoint®. To see the font list, in PowerPoint, on the Home tab, in the Font group, click the arrow to the right of the font.

Font family for complex scripts, specified as a character vector or string scalar. Specify a font family to use when substituting in a locale that requires a complex script, such as Arabic or Asian, to render text.

Font color for the link text, specified as a character vector or string scalar that consists of a CSS color name or hexadecimal RGB value.

  • For a list of CSS color names, see https://www.crockford.com/wrrrld/color.html.

  • To specify a hexadecimal RGB format, use # as the first character and two-digit hexadecimal numbers for the red, green, and blue values. For example, '#0000ff' specifies blue.

Font size for the link text, specified as a character vector or string scalar that consists of a number followed by a unit of measurement. For example, '11pt' specifies 11 points. Valid abbreviations are:

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

Whether to use italic for the link text, specified as true or false. A setting of true renders text in italic.

Strikethrough style for the link text, specified as one of these values:

  • 'single' — Single horizontal line

  • 'none' — No strikethrough line

  • 'double' — Double horizontal line

Whether to display the link text as a subscript, specified as true or false. A setting of true renders text as a subscript.

Whether to display the link text as a superscript, specified as true or false. A setting of true renders text as a superscript.

This property is ignored.

Link text formatting, specified as a cell array of PPT format objects.

Add format objects by concatenating the existing value of the Style property with a cell array that contains the format objects that you are adding. For example:

link = mlreportgen.ppt.InternalLink(3,'link text');
link.Style = [link.Style {Bold(true)}];

See Presentation Formatting Approaches.

This property is not used.

Parent of this object, specified as a PPT object. This property is read-only.

Tag for this PPT API object, specified as a character vector or string scalar. A session-unique tag is generated as part of the creation of this object. The generated tag has the form CLASS:ID, where CLASS is the object class and ID is the value of the Id property of the object.

Specifying your own tag value can help you to identify where an issue occurred during presentation generation.

ID for this PPT API object, specified as a character vector or string scalar. A session-unique ID is generated as part of object creation. You can specify an ID to replace the generated ID.

Methods

expand all

Examples

collapse all

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:

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:

Introduced in R2021a