mlreportgen.dom.LinkTarget Class
Namespace: mlreportgen.dom
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.
The mlreportgen.dom.LinkTarget
class is a handle
class.
Creation
Input Arguments
name
— Name of link target
character vector | string scalar
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, use mlreportgen.utils.normalizeLinkID
. The generated name conforms to the
Microsoft® Word limitation 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,
<a name='appendix'/>
).
Properties
Name
— Name of link target
character vector | string scalar
See name
input argument.
Stylename
— Link target style name
character vector | string scalar
The style specified by styleName
must be defined in the
template used to create the document element to which this link target is
appended.
Data Types: char
| string
IsXRefTarget
— Whether this object is target of mlreportgen.dom.XRef
in PDF report
false
or 0
(default) | true
or 1
Whether this object is the target of an mlreportgen.dom.XRef
object
in an mlreportgen.dom.Document
or
mlreportgen.report.Report
object of type PDF, specified as a numeric or
logical 1
(true
) or 0
(false
). For example see Use Cross-Reference Elements in a PDF Report.
Style
— Format specification
{}
(default) | array of DOM format objects
Format specification for this document element object, specified as an array of DOM
format objects. The formats specified by this property override corresponding formats
specified by the StyleName
property of this element. Formats that
do not apply to this document element object are ignored.
Attributes:
NonCopyable | true |
CustomAttributes
— Custom attributes of document element
[]
(default) | array of mlreportgen.dom.CustomAttribute
objects
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 of the document element to which this object is
appended.
Attributes:
NonCopyable | true |
Tag
— Tag for mlreportgen.dom.LinkTarget
object
character vector | string scalar
Tag for the mlreportgen.dom.LinkTarget
object, specified as a character vector or
string scalar. The DOM API 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. Specify your own tag value to help
you identify where to look when an issue occurs during document generation.
Attributes:
NonCopyable | true |
Data Types: char
| string
Id
— Object identifier for mlreportgen.dom.LinkTarget
object
character vector | string scalar
Object identifier for the mlreportgen.dom.LinkTarget
object, specified as a
character vector or string scalar. The DOM API generates a session-unique identifier
when it creates the document element object. You can specify your own value for
Id
.
Attributes:
NonCopyable | true |
Data Types: char
| string
Methods
Examples
Link to Top of a Document
Define a link target at the top of the report and add an internal link to that target.
import mlreportgen.dom.* import mlreportgen.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);
Version History
Introduced in R2014bGenerate valid link target name for all report types
In a future release, a link target name (ID) generated by mlreportgen.utils.hash
might not be valid for PDF reports. To ensure that a
link target name is valid for all report types, use
mlreportgen.utils.normalizeLinkID
instead of
mlreportgen.utils.hash
.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)