Main Content

slreportgen.webview.WebViewDocument Class

Namespace: slreportgen.webview

Create a web view document generator


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.



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.

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.


expand all

Identifier of current hole in document. This is a read-only property.

An array of slreportgen.webview.ExportOptions objects, one for each model or set of models to be exported. The generator’s constructor sets this property with default values for the model or 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, specified as numeric or logical 0 (false) or 1 (true).

Data Types: logical

Whether to overwrite an existing report with the same name. True overwrites the existing report. False generates the report under a new name.

Path of the document output directory.

Packaging to use for output document, specified as one of these character vectors:

  • 'zipped' — Creates a zip file with an .htmx extension

  • 'unzipped' — Creates a folder of files

  • 'both' — Creates both zipped and unzipped output

Path to the HTML template to use to generate this report. The template has an .htmtx extension. This property points by default to a default template. To use a custom template, set this property to the path of the custom template.

Text to display in the title bar of the HTML browser displaying the generated web view document. The default text is “Simulink Web View - Created by Simulink Report Generator."


expand all


collapse all

import slreportgen.webview.*
d = WebViewDocument('f14WebView', 'f14');

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.*
wvdoc = WebViewDocument(...
opts = wvdoc.ExportOptions;
f14Opts = opts(1);
f14Opts.IncludeMaskedSubsystems = true; 
f14Opts.IncludeSimulinkLibraryLinks = true;

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


This example exports f14’s root system and Aircraft Dynamics Model subsystem.

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

This example exports f14’s root system and Controller subsystem.

import slreportgen.webview.*
wvdoc = WebViewDocument(...
    'mydoc', 'f14/Controller');
wvdoc.ExportOptions.SearchScope = 'CurrentAndAbove';

Version History

Introduced in R2017a