Main Content

slreportgen.webview.WebViewDocument Class

Namespace: slreportgen.webview

Create a web view document generator

Description

Creates a document generator that generates an HTML document containing a web view of one or more Simulink® models.

The slreportgen.webview.WebViewDocument class is a handle class.

Creation

Description

wvdocgen = slreportgen.webview.WebViewDocument(docname,model) creates a document generator that generates an HTML document at the specified location containing a web view of the specified model. Use the generator’s fill method to generate the document.

wvdocgen = slreportgen.webview.WebViewDocument(docname,model1,model2,...modeln)creates a document generator that includes two or more models in the web view that it creates. This constructor assigns an array of default slreportgen.webview.ExportOptions objects to the generator’s ExportOptions property, one for each of the models to be included in the generated document’s web view. You can use the objects to specify custom export options for the models to be exported.

example

wvdocgen = slreportgen.webview.WebViewDocument(docname,{model1,model2,...modeln}) assigns a default slreportgen.webview.ExportOptions object to the generator’s ExportOptions property that applies to all of the models to be exported.

wvdocgen = slreportgen.webview.WebViewDocument(docname) creates a web view document generator for an initially unspecified model or set of models. Use the Systems property of the generator’s ExportOptions property to specify the model or models to be included in the web view that it generates.

Input Arguments

expand all

Name of the ZIP file and/or folder containing the report generated by this generator. Use this generator’s PackageType property to specify whether to package the generated report as a file or a folder or both. If you specify an extension, the extension must be.htmx. If you do not specify an extension, the report generator appends .htmx.

Name of the Simulink model to export to an interactive HTML Web view, specified as a character vector.

Properties

expand all

Identifier of current hole in document, stored as a character vector or string scalar.

Attributes:

Dependent
true
NonCopyable
true

Data Types: char | string

Web view export options, specified as an array of slreportgen.webview.ExportOptions objects, one for each model or set of models to be included in the web view exported to the generated report. The constructor of the generator constructor sets this property with default values for the models you specify. Use the properties of the ExportOptions object or objects to customize export of the models to the generated web view. For example, you can specify additional models to include or whether to include the block diagrams of masked subsystems and library blocks.

Whether to include user notes in the web view, specified as "on" or "off", or as numeric or logical 1 (true) or 0 (false). A value of "on" is equivalent to true, and "off" is equivalent to false. Thus, you can use the value of this property as a logical value. The value is stored as an on/off logical value of type matlab.lang.OnOffSwitchState.

  • "on" — includes user notes in the web view.

  • "off" — does not include user notes in the web view.

Whether to overwrite an existing report with the same name, specified as "on" or "off", or as numeric or logical 1 (true) or 0 (false). A value of "on" is equivalent to true, and "off" is equivalent to false. Thus, you can use the value of this property as a logical value. The value is stored as an on/off logical value of type matlab.lang.OnOffSwitchState.

  • "on" — overwrites the existing report.

  • "off" — generates the report under a new name.

Status of the report being generated, specified as "unopened" or "opened".

Attributes:

Dependent
true
NonCopyable
true

Data Types: char | string

Path of the report output directory, specified as a character vector or a string scalar.

Attributes:

Dependent
true
NonCopyable
true

Data Types: char | string

Packaging to use for files generated for output document, specified as one of these values:

  • "both" — Creates both zipped and unzipped output

  • "zipped" — Creates a ZIP file with an .htmx extension

  • "unzipped" — Creates a folder of files

Attributes:

Dependent
true
NonCopyable
true

Data Types: char | string

Path to the HTML template to use to generate this report, specified as a character vector or string scalar. The template has an .htmtx extension. This property points to a default HTML template. To use a custom template, set this property to the path of the custom template.

Attributes:

Dependent
true
NonCopyable
true

Data Types: char | string

Text to display in the title bar of the HTML browser used to display the generated report, specified as a character vector or a string scalar. The default text is "Simulink Web View - Created by Simulink Report Generator".

Attributes:

Dependent
true
NonCopyable
true

Data Types: char | string

Methods

expand all

Examples

collapse all

import slreportgen.webview.*
openExample("f14")
d = WebViewDocument("f14WebView", "f14");
fill(d);
rptview(d);

The export options in this example allow you to view the subsystem that implements the Simulink library block, Band-Limited White Noise, in the f14 model and the Stateflow® chart that implements the Engine block in the sf_car model. If the example did not enable the export options, the subsystem and chart would appear only as blocks in the exported web view.

import slreportgen.webview.*
open_system('f14');
open_system('sf_car');
wvdoc = WebViewDocument(...
    'myWebview','f14','sf_car'); 
opts = wvdoc.ExportOptions;
 
f14Opts = opts(1);
f14Opts.IncludeMaskedSubsystems = true; 
f14Opts.IncludeSimulinkLibraryLinks = true;

sfcarOpts = opts(2);
sfcarOpts.IncludeMaskedSubsystems = true; 

fill(wvdoc)
rptview(wvdoc);

This example exports the root system of f14 and Aircraft Dynamics Model subsystem.

import slreportgen.webview.*
openExample("f14");
wvdoc = WebViewDocument("myWebView", ...
    {"f14", "f14/Aircraft Dynamics Model"});
wvdoc.ExportOptions.SearchScope = "Current";
fill(wvdoc)
rptview(wvdoc);

This example exports the root system of f14 and Controller subsystem.

import slreportgen.webview.*
openExample("f14");
wvdoc = WebViewDocument(...
    "mydoc", "f14/Controller");
wvdoc.ExportOptions.SearchScope = "CurrentAndAbove";
fill(wvdoc)
rptview(wvdoc);

Version History

Introduced in R2017a