Create Hyperlinks for Embedded Web View Report

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 method creates two-way links between a report on the workspace variables used by the exported model and blocks that use those variables:

function fillContent(rpt)
    import mlreportgen.dom.*  
    model = getExportModels(rpt);
    vars = Simulink.findVars(model,'ReturnResolvedVar', true);
    nVars = numel(vars);
        for i = 1:nVars
           varInfo = vars(i)
           append(rpt, Heading1(varInfo.Name);
           nUsers = numel(varInfo.Users);
           for u = 1:nUsers
        	 userPath = varInfo.Users{u};
             userLink = createElementTwoWayLink(rpt, ...
                          userPath, (userPath));
             append(rpt,userLink);
        end       
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.