Main Content

mlreportgen.report.SectionTitle Class

Namespace: mlreportgen.report
Superclasses: mlreportgen.report.Title

Generate a section title

Description

Only another report, called the owner, can create an instance of this class. The instance fills a hole in a template that the owner specifies with a title that the owner specifies via an instance template and the instance properties that it sets. For example, an mlreportgen.report.Section reporter (the owner) uses an instance of this class to fill the Title hole in its template with a hierarchically numbered title.

The title generated by an instance of this class consists of static text and dynamic content. The static text is specified by the instance template. The dynamic content is specified by the instance Content, NumberPrefix, and NumberSuffix properties. If the name of a template hole matches one of these property names, this reporter fills the hole with the value property. For example, if the title template contains a Content hole and a NumberPrefix hole, this reporter fills those holes with the values of the corresponding properties.

The owner specifies the location of the title template with the instance TemplateSrc, TemplateName, and OutlineLevel properties. The TemplateSrc property specifies the source of a template file whose template library contains the title template. The TemplateName property specifies the root name of the title template. The OutlineLevel property specifies the level in the report hierarchy of the content generated by the owner. The SectionTitle instance appends the value of the OutlineLevel property to the value of the TemplateName property to create the full name of the title template. For example, the Section reporter template library contains six numbered title templates, each corresponding to a section level. The names of the templates are SectionNumberedTemplate1, SectionNumberedTemplate2, and so on. To specify use of the SectionNumberedTemplate1 template to generate a section title, the Section reporter sets the SectionTitle TemplateName property to SectionNumberedTemplate and the OutlineLevel property to 1.

If the SectionTitle LinkTarget property is set, the instance precedes the generated title with a link target having the specified target ID.

The mlreportgen.report.SectionTitle class is a handle class.

Properties

expand all

Name of the title hole in the owner template, specified as a character vector or string scalar.

Title text, specified as one of these values:

  • String scalar or character vector

  • DOM object

  • 1-by-N or N-by-1 array of strings or DOM objects

  • 1-by-N or N-by-1 cell array of strings, character vectors, and/or DOM objects

Prefix for a section number in the title, specified as a character vector or string scalar. If no prefix is specified, the default title prefix, translated based on the report locale, is used.

Suffix for a section number in the title, specified as a character vector or string scalar. If no suffix is specified, the default title suffix, translated based on the report locale, is used.

Translation map for the section title prefix and suffix, specified as a MATLAB® structure. If the specified translation map does not contain a translation for the report locale, the Translations property uses en as the backup locale. See the Locale property of mlreportgen.report.Report for information about valid locales.

Outline level of the owner reporter in the report section hierarchy, specified as a positive integer in the range [1,6]. The OutlineLevel property specifies the level of the section generated by the owner reporter in the section hierarchy of a report. The SectionTitle reporter appends the value of this property to the value of the TemplateName property to create the full name of the title template. For example, if the value of the TemplateName property is SectionNumberedTitle and the value of the OutlineLevel property is 2, this reporter generates SectionNumberedTitle2 as the full name of the title template. The template library specified by the TemplateSrc property must contain a template with the generated name. Otherwise, an error occurs.

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.

Template root name, specified as a character vector or string scalar. The template for this reporter is 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 as 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.

Version History

Introduced in R2018b