Main Content

mlreportgen.dom.InternalLink class

Package: mlreportgen.dom
Superclasses:

Hyperlink to a location in same document

Description

Hyperlink to a location in the same document that contains the hyperlink. Use this kind of link to provide internal navigation within a document.

Construction

internalLinkObj = InternalLink(targetName,linkText) creates a hyperlink to the specified link target object and uses the specified link text.

internalLinkObj = InternalLink(targetName,linkText,linkTextStyleName) creates a hyperlink to the specified link target and uses the specified style name for the link text.

internalLinkObj = InternalLink(targetName,textObj) creates a hyperlink to the specified target using the specified Text object.

Input Arguments

expand all

Link target name, specified as character vector. The character vector is the value in the Name property of an mlreportgen.dom.LinkTarget object or a URL.

The text to use for the link text.

Name of style to use for the link text.

Text object containing link text, specified by an mlreportgen.dom.Text object.

Output Arguments

expand all

Internal link, represented by an mlreportgen.dom.InternalLink object.

Properties

expand all

Children of this document element, specified as an array of DOM objects. This property is read-only.

Custom attributes of this document element, specified as an array of mlreportgen.dom.CustomAttribute objects. The custom attributes must be supported by the output format.

ID for this document element, specified as a character vector or string scalar. The DOM generates a session-unique ID when it creates the document element. You can specify your own ID.

Parent of this document element, specified as a DOM object. This property is read-only.

Name of link style defined in the template, specified as a character vector. The style specified by styleName must be defined in the template used to create the document to which the link is appended.

Format objects that specify the format of a document element.

Tag for this document element, specified as a character vector or string scalar.

The DOM generates a session-unique tag 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 document generation.

This read-only property displays the link target of this hyperlink.

Methods

Method

Purpose

append

Use InternalLink.append in a similar way to how you use ExternalLink.append.

Append text or a Text, Image, or CustomElement object.

clone

Use InternalLink.clone in a similar way to how you use Paragraph.clone.

Copy the internal link.

Examples

collapse all

Link to a target in the same document by using an mlreportgen.dom.LinkTarget object to define the link target and an mlreportgen.dom.InternalLink object to define the link. The link target name associates the link with the link target. To generate a link target name that is valid for all report types, use mlreportgen.utils.normalizeLinkID.

import mlreportgen.dom.*
import mlreportgen.utils.*
d = Document('mydoc','pdf');

% Append a link target to a heading
h = Heading(1,'Author''s Biography');
h.Style = {PageBreakBefore(true)};
linkID = normalizeLinkID('bio');
append(h,LinkTarget(linkID));

% Link to the target
append(d,InternalLink(linkID,'About the Author'));

% Append the heading 
append(d,h);

close(d);
rptview(d);