Main Content

slreportgen.report.Report class

Package: slreportgen.report

Report container

Description

slreportgen.report.Report is a container for a report based on 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 pairs. You can specify multiple name-value pair arguments in any order.

Input Arguments

expand all

See the OutputPath property.

See the Type property.

See the TemplatePath property.

Properties

expand all

Report document output path, specified as a string or character array. The path is the location in the file system where the report output document is stored. The path can be a full path or a path relative to the current MATLAB folder, for example, 'C:/myreports/reportA.docx' or 'reportA'. If the file name does not have a file extension corresponding to the Type property, the appropriate file extension is added.

Note

Generating a PDF report on a cloud drive, such as MATLAB Drive™, can result in an error that is caused by file contention between the report generation software and the cloud drive synchronization software. To avoid this error, 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.

Output type, specified as one of these values.

  • 'HTML' — HTML report packaged as a zipped file containing the HTML file, images, style sheet, and JavaScript® files of the report.

  • 'HTML-FILE' — HTML report as a single HTML file containing the text, style sheet, JavaScript, and base64-encoded images of the report

  • 'PDF' — PDF file

  • 'DOCX'Microsoft® Word document

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

Page layout options for this report, specified as a report layout object. See mlreportgen.report.ReportLayout.

Locale or language, specified as the ISO 639-1 two-letter language code of the locale for which this report is to be generated. The default [] 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, and zh. If you specify an unsupported locale, the English version is used. See ISO 639-1 codes.

Location of template used to format the report, specified as a string or character array. Use this property to specify a custom template for this report.

This read-only property is an mlreportgen.dom.Document that is used to generate the content of the report.

This read-only property is a containers.Map object that contains information for generating the report, such as the hierarchical level of the current report section.

Debug mode, specified as a logical. If you set Debug to true, the temporary files for the report are stored in a subfolder of the report folder. In debug mode, these files are not deleted when the report is closed.

Whether to compile the Simulink model before reporting, specified as a logical. If this property is true and the model is not already compiled, it compiles when you add a reporter that reports on that model to this report. If the model cannot be compiled, report generation terminates. If this property is false, report generation proceeds without compiling the model.

Packaging used for the generated files, specified as one of the values in the table.

ValueSupported Report TypesDescription

'zipped'

'docx'or '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 packaged in a zip file named s:\docs\MyDoc.docx.

'unzipped'

'docx' or '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' or 'html'

Generates zipped and unzipped outputs.

'single-file'

'pdf' or 'html-file'

Generates the report as a single file.

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

Methods

expand all

Version History

Introduced in R2017b

expand all