Main Content

slreportgen.report.DocBlock class

Package: slreportgen.report
Superclasses: slreportgen.report.Reporter

DocBlock reporter

Description

Use an object of the slreportgen.report.DocBlock class to report on a DocBlock block.

Note

To use a DocBlock reporter in a report, you must create the report using the slreportgen.report.Report class or subclass.

The reporter includes the DocBlock content in a report in one of these ways:

  • Includes the actual content in the report

  • Saves the content to an external file and adds a link to the file in the report

  • Embeds the content as a file in the report and adds a link to the embedded file

The table shows when the reporter includes, links to, or embeds the content, depending on the DocBlock content type, the report type, and the values of the ConvertHTML and EmbedFile properties.

DocBlock Content TypeReport TypeConvertHTML PropertyEmbedFile PropertyReport Contains
DocBlock ContentExternal Link to DocBlock Content FileLink to Embedded DocBlock Content File
textHTMLN/AN/Ayesnono
textHTML-FILEN/AN/Ayesnono
textWordN/AN/Ayesnono
textPDFN/AN/Ayesnono
HTMLHTMLN/AN/Ayesnono
HTMLHTML-FILEN/AN/Ayesnono
HTMLPDFtrueN/Ayesnono
HTMLPDFfalsetruenonoyes
HTMLPDFfalsefalsenoyesno
HTMLWordtrueN/Ayesnono
HTMLWordfalseN/Anoyesno
RTFPDFN/Atruenonoyes
RTFPDFN/Afalsenoyesno
RTFWordN/AN/Ayesnono
RTFHTMLN/Atruenonoyes
RTFHTMLN/Afalsenoyesno
RTFHTML-FILEN/AN/Anoyesno

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

Class Attributes

HandleCompatible
true

For information on class attributes, see Class Attributes.

Creation

Description

rptr = slreportgen.report.DocBlock() creates an empty DocBlock reporter based on a default template. Customize the content and format of the generated content by using the reporter properties. Before you add the reporter to a report, you must specify the DocBlock in the Object property of the reporter. Adding an empty reporter to a report produces an error.

example

rptr = slreportgen.report.DocBlock(docBlockObj) creates a DocBlock reporter for the DocBlock specified by docBlockObj, which can be a DocBlock path or handle. See the Object property.

rptr = slreportgen.report.DocBlock(Name,Value) sets the reporter properties using name-value pairs. You can specify multiple name-value pair arguments in any order. Enclose each property name in single or double quotes.

Properties

expand all

Simulink DocBlock block, specified as a string scalar or character vector that contains the path to a DocBlock or as a handle to a DocBlock block.

Note

If you use a finder to find DocBlock blocks and add the results directly to a report, DocBlock reporters are used to report on the DocBlock blocks rather than Simulink object property reporters.

Whether to import plain text content in line, specified as true or false. If ImportTextInline is false, before the reporter appends the content to a hole, it wraps the content in one or more paragraphs, depending on the value of the TexSep property. Set ImportTextInline to true to append DocBlock text content to a hole in a paragraph (an inline hole).

Separator used to delimit paragraphs in plain text content, specified as one of the values in the table. You can specify the value as a string scalar or a character vector.

ValueDescription
"Ignore"Wrap text in a single paragraph regardless of whether it contains separators. (default)
"LineFeed"If a text segment ends with a line feed, wrap it in a paragraph.
"BlankLine"If a text segment ends with a blank line, wrap it in a paragraph.

Whether to include HTML content, specified as true or false.This property applies only to Word and PDF reports.

If the value is true, HTML content is converted to DOM objects and appended to a report.

If the value is false:

  • For a PDF report, the report embeds the content or includes an external link to the content, depending on the value of the EmbedFile property.

  • For a Word report, the report includes an external link to the content.

If the report is an HTML or HTML file report, the HTML content is included in the report, regardless of the value of the ConvertHTML property.

Whether to embed the content of a DocBlock block in the generated report, specified as true or false. This property applies only to HTML or RTF content with PDF reports and to RTF content with HTML reports. If the value is true, the reporter embeds the DocBlock content in the report and inserts a hyperlink to the embedded file.

Paragraph formatter object that formats plain text if the ImportTextInline property is false, specified as an mlreportgen.dom.Paragraph object. The initial value of the ParagraphFormatter property is an mlreportgen.dom.Paragraph object with default property values. To customize the appearance of the paragraph, modify the mlreportgen.dom.Paragraph object properties or replace the object with a customized mlreportgen.dom.Paragraph object. If you add content to the default or replacement paragraph object, the content appears in front of the DocBlock content in the generated report.

Text formatter object that formats plain text if the ImportTextInline property is true, specified as an mlreportgen.dom.Text object. The initial value of the TextFormatter property is an mlreportgen.dom.Text object with default property values. To customize the appearance of the text, modify the mlreportgen.dom.Text object properties or replace the object with a customized mlreportgen.dom.Text object. If you add content to the default or replacement paragraph object, the content appears in front of the DocBlock content in the generated report.

Source of the template for this reporter, specified in one of these ways:

  • Character vector or string scalar that specifies the path of the file that contains the template for this reporter

  • Reporter or report whose template is used for this reporter or whose template library contains the template for this reporter

  • DOM document or document part whose template is used for this reporter or whose template library contains the template for this reporter

The specified template must be the same type as the report to which this reporter is appended. For example, for a Microsoft® Word report, TemplateSrc must be a Word reporter template. If the TemplateSrc property is empty, this reporter uses the default reporter template for the output type of the report.

Name of the template for this reporter, specified as a character vector or string scalar. The template for this reporter must be in the template library of the template source (TemplateSrc) for this reporter.

Hyperlink target for this reporter, specified as a character vector or string scalar that specifies the link target ID, or an mlreportgen.dom.LinkTarget object. A character vector or string scalar value is converted to a LinkTarget object. The link target immediately precedes the content of this reporter in the output report.

Methods

expand all

Examples

collapse all

Include the content from the Sensor Info DocBlock of the slrgex_fuelsys model in a report by adding a DocBlock reporter to the report. Specify that paragraphs in the DocBlock are delimited by a linefeed.

% Import the API package
import slreportgen.report.*
import mlreportgen.report.*

% Load the model
model_name = "slrgex_fuelsys";
load_system(model_name);
docBlock = "slrgex_fuelsys/To Controller/Sensor Info";

% Create a report 
rpt = slreportgen.report.Report("output","pdf");

% Create a chapter reporter
chapter = Chapter(docBlock);

% Create a DocBlock reporter
% Specify that paragraphs are delimited by a linefeed 
rptr = DocBlock(docBlock);
rptr.TextSep = "LineFeed";

% Add the DocBlock reporter to the chapter
% Add the chapter to the report
add(chapter, rptr);
add(rpt, chapter);

% Close and view the output report
close(rpt);
close_system(model_name);
rptview(rpt);

Here is the content from the Sensor Info DocBlock in the generated report:

Introduced in R2019b