Main Content

slreportgen.report.Report Class

Namespace: slreportgen.report

Report container

Description

slreportgen.report.Report is a container for a report consisting of Simulink® reporters and DOM objects. Use this object to generate an HTML, PDF, or Word report based on templates in a template library.

Note

Use objects of this type, instead of mlreportgen.report.Report, to create Simulink reports, which are reports that use Simulink reporters to generate content. You can also use MATLAB® reporters and DOM objects to generate Simulink report content.

The slreportgen.report.Report class is a handle class.

Creation

Description

report = slreportgen.report.Report returns a report object report with the default report type (PDF) and a default file name (untitled.pdf).

report = slreportgen.report.Report(path) uses the specified output path for the report.

report = slreportgen.report.Report(path,type) creates the specified type of report.

report = slreportgen.report.Report(path,type,template) uses the specified template.

report = slreportgen.report.Report(Name=Value) sets properties using name-value arguments. You can specify multiple name-value arguments in any order.

Input Arguments

expand all

See the OutputPath property.

See the Type property.

See the TemplatePath property.

Properties

expand all

Whether to compile the Simulink model before reporting, specified as logical true or false. If this property is true (default), adding a reporter that reports on a model to this report causes the model to be compiled if it is not already compiled. If the model cannot be compiled, report generation terminates. A false value allows report generation to proceed without compiling the model

Attributes:

GetAccess
public
SetAccess
public

Data Types: logical

Path of the generated report file, specified as a character vector or string scalar. The path is the location in the file system of the report output document. The path can be a full path, for example, "C:/myreports/reportA.docx". The path can also be relative to the current MATLAB folder, for example, "reportA". If the file name does not have a file extension that corresponds to the Type property, the report generator adds the appropriate file extension when the report document is closed.

Note

Generating a PDF report on a cloud drive, such as MATLAB Drive™ or Microsoft® OneDrive™, can cause file contention between the report generation software and the cloud drive synchronization software resulting in a version of this error:

Error closing document package: Could not commit changes: removeAll failed: fl:filesystem:AccessDenied: 
C:\Users\jdoe\OneDrive\Documents\MATLAB\reports\temp_FO\stylesheets: Permission denied.
To avoid this issue, generate reports on a local drive that does not synchronize with the cloud. Consider writing a script that generates a report on a local drive and then copies the report to the cloud drive.

Attributes:

GetAccess
public
SetAccess
public

Data Types: char | string

Output type, specified as one of these values:

  • "docx"Microsoft Word document.

  • "html" — HTML report, packaged as a zipped file that contains the HTML file, images, style sheet, and JavaScript® files of the report. To generate an HTML report as a folder that contains unzipped files, set the PackageType property to "unzipped" or "both".

  • "html-file" — HTML report that consists of a single HTML file that contains the text, style sheets, JavaScript, and base64-encoded images of the report.

  • "pdf"— PDF file.

  • "pdfa" — PDF/A file. (since R2025a)

If you specify a template using the TemplatePath property, the value for Type must match the template type.

Attributes:

GetAccess
public
SetAccess
public

Data Types: char | string

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

ValueSupported Report TypesDescription

"zipped"

  • "docx"

  • "html"

Generates the report as a ZIP file at the location specified by the OutputPath property. The ZIP file has an extension that matches the document type (.docx for Word output or .htmtx for HTML output.) For example, if the document type is "docx" and OutputPath is s:\docs\MyDoc, the output is in a ZIP file named s:\docs\MyDoc.docx.

"unzipped"
  • "docx"

  • "html"

Generates the report as separate files in a folder that has the file name of the OutputPath property. For example, if the OutputPath is s:\docs\MyDoc, the output folder is s:\docs\MyDoc.

"both"
  • "docx"

  • "html"

Generates zipped and unzipped outputs.

"single-file"
  • "html-file"

  • "pdf"

  • "pdfa" (since R2025a)

Generates the report as a single file.

Tip

To generate an HTML report that you can open without unzipping when the Type property is "html", set PackageType to "unzipped" or "both". In the folder that contains the generated files, open the root.html file.

Attributes:

GetAccess
public
SetAccess
public
NonCopyable
true

Data Types: char | string

Location of the template to use to format this report, specified as a character vector or string scalar. You can use this property to specify a custom template for the report.

Attributes:

GetAccess
public
SetAccess
public

Data Types: char | string

Locale or language, specified as a character vector or string scalar that consists of the ISO_639-1 two-letter language code of the locale for which this report is to be generated. The default value, [], specifies the language of the system locale, for example, English on an English system. The Report API uses the language code to translate chapter title prefixes to the language of the specified locale. Translations are provided for the following locales:

  • "af"

  • "ca"

  • "cs"

  • "da"

  • "de"

  • "el"

  • "en"

  • "es"

  • "et"

  • "eu"

  • "fi"

  • "fr"

  • "hu"

  • "id"

  • "it"

  • "ja"

  • "ko"

  • "nl"

  • "nn"

  • "no"

  • "pl"

  • "pt"

  • "ro"

  • "ru"

  • "sk"

  • "sl"

  • "sr"

  • "sv"

  • "tr"

  • "uk"

  • "xh"

  • "zh"

. If you specify an unsupported locale, the English version is used. For more information, see List of ISO_639-1 codes on the Wikipedia website.

For an example, see Specify a Locale for Chapter Title Prefixes.

Attributes:

GetAccess
public
SetAccess
public

Data Types: char | string

Debug mode, specified as a numeric or logical 1 (true) or 0 (false). If you set Debug to true or 1, the temporary files for the report are stored in a subfolder of the report folder and are not deleted when the report is closed.

Attributes:

GetAccess
public
SetAccess
public

Data Types: logical

Page layout options for this report, specified as an mlreportgen.report.ReportLayout object. The default value of the Layout property is an mlreportgen.report.ReportLayout object with default values. Customize the page layout by modifying the property values. For an example, see Create a Landscape Report.

The layout options specified by the Layout property of objects of the mlreportgen.report.TitlePage, mlreportgen.report.TableOfContents, and mlreportgen.report.Chapter classes can override the page layout properties specified by the Layout property of an mlreportgen.report.Report object.

Note

The Layout property applies only to PDF and Word reports.

Attributes:

GetAccess
public
SetAccess
protected

DOM document object to use to generate the content of the report, specified as an mlreportgen.dom.Document object.

Attributes:

GetAccess
public
SetAccess
private

Report context, specified as a containers.Map object that contains the information to use to generate the report, such as the hierarchical level of the current report section.

Attributes:

GetAccess
public
SetAccess
private

Methods

expand all

Version History

Introduced in R2017b

expand all