To create one-way and two-way hyperlinks between the document and the Web View
embedded in the report, use these methods. These linking methods are inherited from the
slreportgen.webview.EmbeddedWebViewDocument
base class of the report generator.
createDiagramTwoWayLink
—
Create a two-way link between a document location and a diagram in the
Embedded Web View. Clicking a link created by this method in the document
opens the target diagram in the Web View. Clicking in the diagram scrolls
the document pane to the target document location.
createElementTwoWayLink
—
Create a two-way link between a document location and a diagram element in
the Embedded Web View. Clicking a link created by this method in a document
opens the diagram containing the model element and flashes the element.
Clicking the element in the diagram scrolls the document pane to the target
document location.
createDiagramLink
— Creates
a link from the document to a diagram in the Embedded Web View.
createElementLink
— Creates
a link from the document to an element of a block diagram in the Embedded
Web View.
For example, the following code creates two-way links between a report on the variables used by the exported model and blocks that use those variables.
function fillContent(rpt) import mlreportgen.dom.* import mlreportgen.report.* model = getExportModels(rpt); model= model{1}; % Find variables used by the reported model finder = slreportgen.finder.ModelVariableFinder(model); % Create a Variables Chapter ch = Chapter("Variables"); while hasNext(finder) result = next(finder); % Create a section for the variable s = Section(result.Name); % Add variable information to the section reporter = getReporter(result); reporter.ShowUsedBy = false; add(s, reporter); % Create a Users list with links to the embedded model usedByPara = Paragraph("Used By:"); usedByPara.Bold = true; add(s, usedByPara); users = result.Users; nUsers = numel(users); for u = 1:nUsers userLink = createElementTwoWayLink(rpt, ... users{u}, ... Paragraph(users{u})); add(s, userLink); end %Add this section to the chapter add(ch, s); end % Add the chapter to the report add(rpt, ch); end
For other tasks to create your Embedded Web View generator, see:
To generate the Embedded Web View report, see Generate an Embedded Web View Report.