getReportObject

Class: slreportgen.webview.EmbeddedWebViewDocument
Package: slreportgen.webview

Returns the report object for an embedded web view report

Syntax

rptobj = getReportObject(rpt) returns

Description

rptobj = getReportObject(rpt) returns the slreportgen.report.Report object associated with an embedded web view report. You can use the report object to get the DOM object that implements a reporter in your report. Examining the DOM implementation can help you to debug report generation issues.

Input Arguments

expand all

Embedded web view report, specified as an object of a subclass of slreportgen.webview.EmbeddedWebViewDocument.

Output Arguments

expand all

Report object, returned as an slreportgen.report.Report object.

Examples

expand all

Get the report object for an embedded web view report by calling the getReportObject method. Then, get the DOM object that implements the title page reporter in the report.

Create the embedded web view class used in Generate an Embedded Web View Report.

classdef SystemDesignVariables < slreportgen.webview.EmbeddedWebViewDocument
    
    methods
        function rpt = SystemDesignVariables(reportPath, modelName)
            
            rpt@slreportgen.webview.EmbeddedWebViewDocument(reportPath,...
                modelName);
            
            rpt.ValidateLinksAndAnchors = false;
            
            rpt.ExportOptions.IncludeMaskedSubsystems = true;
            rpt.ExportOptions.IncludeSimulinkLibraryLinks = true;
            rpt.ExportOptions.IncludeReferencedModels = true;
        end
        
        function fillContent(rpt)
            import mlreportgen.dom.*
            import mlreportgen.report.*
            
            model = getExportModels(rpt);
            model= model{1};
            tp = TitlePage("Title",[model " Report"],"Author","");
            add(rpt,tp);
            finder = slreportgen.finder.ModelVariableFinder(model);
            ch = Chapter("Variables");
            while hasNext(finder)
                result = next(finder);
                s = Section(result.Name);
                reporter = getReporter(result);
                add(s,reporter);
                add(ch,s);
            end
            add(rpt,ch);
        end
    end
end

Using the MATLAB® Editor, set a breakpoint at this line:

add(rpt,tp);

Run a script to generate the embedded web view report.

model = 'f14';
rptName = sprintf('%sVariables', model);
load_system(model);
rpt = SystemDesignVariables(rptName, model);
fill(rpt);
close(rpt);
close_system(model);
rptview(rptName);

MATLAB pauses at the breakpoint.

In the Editor, at the command prompt, run these commands:

rptObj = getReportObject(rpt);
impl = getImpl(tp,rptObj)

The DOM implementation for the title page reporter displays.

To end the debugging session, click Quit Debugging.

To clear the breakpoint, right-click the breakpoint icon and select Clear Breakpoint from the context menu.

Introduced in R2019b