Main Content

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 aLinkTargetobject when you construct anmlreportgen.dom.InternalLinkormlreportgen.dom.ImageAreaobject.

Construction

targetObj= LinkTarget(name)创建一个与指定名称链接目标。

Input Arguments

expand all

Name of a link target, specified as a character vector or string scalar.

Note

To generate a link target name that is valid for all report types, usemlreportgen.utils.normalizeLinkID. The generated name conforms to theMicrosoft®Wordlimitation on ID length and the PDF requirement that an ID begin with an alphabetic character.

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

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,).

Output Arguments

expand all

Link target, represented by anmlreportgen.dom.LinkTargetobject.

Properties

expand all

Custom attributes of this document element, specified as an array ofmlreportgen.dom.CustomAttribute对象. 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.

Seenameinput argument.

Format objects that specify the format of a document element.

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

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 theIdproperty of the object. Specifying your own tag value can help you to identify where an issue occurred during document generation.

Methods

Method

Purpose

append

Append content to link target.

clone

UseLinkTarget.clonein a similar way to how you useParagraph.clone.

Copy link target.

Examples

collapse all

Define a link target at the top of the report and add an internal link to that target.

importmlreportgen.dom.*importmlreportgen.utils.*d = Document('mydoc','pdf'); p = Paragraph('This is my paragraph'); linkID = normalizeLinkID('home'); append(p,LinkTarget(linkID)); append(d,p); p = Paragraph('This is another paragraph'); p.Style = {PageBreakBefore(true)}; append(d,p); append(d,InternalLink(linkID,'Go to Top')); close(d); rptview(d);

Compatibility Considerations

expand all