Main Content

mlreportgen.utils.normalizeLinkID

Normalize a link target ID

Since R2020a

Description

example

outID = mlreportgen.utils.normalizeLinkID(inID) converts the input link target ID to an ID that is valid for Microsoft® Word, PDF, and HTML reports. The output ID consists of the prefix mw_ and an MD5 hash of the input ID. The generated ID conforms to the Word limitation on ID length and the PDF requirement that an ID begin with an alphabetic character.

Examples

collapse all

This example generates a report where one paragraph links to another paragraph. The link target ID of the target paragraph is generated by using mlreportgen.utils.normalizeLinkID.

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);

Input Arguments

collapse all

Link target ID to be normalized, specified as a character vector or string scalar.

Output Arguments

collapse all

Normalized link target ID, returned as a string scalar.

Tips

To generate a link target ID for a Simulink® or Stateflow® object, use slreportgen.utils.getObjectID (Simulink Report Generator). This function generates a link target ID that is valid for all report types.

Version History

Introduced in R2020a