Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

mlreportgen.dom.LinkTarget class

Package: mlreportgen.dom
Superclasses:

Target for internal or external links or image area links

Description

A target to use for internal and external links and for image area links. You can specify a LinkTarget object when you construct an mlreportgen.dom.InternalLink or mlreportgen.dom.ImageArea object.

Construction

targetObj = LinkTarget(name) creates a link target with the specified name.

Input Arguments

expand all

Name of a link target, specified as a character vector.

To set up a link target for an external link:

  • In a Word report, specify a Word bookmark.

  • In an HTML report, specify an HTML named anchor (for example, <a name='appendix'/>).

Microsoft® Word replaces spaces in a link target names with underscore characters. Avoid spaces in link target names in Word reports.

Output Arguments

expand all

Link target, represented by an mlreportgen.dom.LinkTarget object.

Properties

expand all

The output format must support the custom attributes of this document element.

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

Microsoft Word replaces spaces in a link target names with underscore characters. Avoid spaces in link target names in Word reports.

Format objects that specify the format of a document element.

The style specified by styleName must be defined in the template used to create the document element to which this link target is appended.

Tag for document element, specified as a character vector.

A session-unique ID is generated as part of document element creation. The generated tag has the form CLASS:ID, where CLASS is the class of the element and ID is the value of the Id property of the object. You can specify a tag to replace the generated tag.

For example, to make it easier to identify where an issue occurred during document generation, you can specify your own tag value.

Methods

Method

Purpose

append

Append content to link target.

clone

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

Copy link target.

Examples

expand all

Define a link target at the top of the report and add an internal link to that target. In an actual report, links to this target would appear further down in the report.

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

p = Paragraph('This is my paragraph');
append(p,LinkTarget('home'));
append(d,p);
p = Paragraph('This is another paragraph');
p.Style = {PageBreakBefore(true)};
append(d,p);

append(d,InternalLink('home','Go to Top'));

close(d);
rptview(d.OutputPath);
Was this topic helpful?