Main Content

mlreportgen.report.Title Class

Namespace: mlreportgen.report
Superclasses: mlreportgen.report.Reporter

Fill title hole reporter

Description

Reporter that other reporters, such as Chapter, FormalImage, and BaseTable, use to fill a title hole in a template.

An instance of this class can be created only by another reporter, which is called the owner. The instance fills a hole in a template that the owner specifies with a title that the owner specifies via an instance template and instance properties that it sets. For example, the BaseTable 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 via the instance TemplateSrc and TemplateName properties. The TemplateSrc property specifies the source of a template file whose template library contains the title template. The TemplateName property specifies the name of the title template. For example, the BaseTable reporter template library contains two numbered title templates, one named BaseTableNumberedTitle for numbered tables, and one named BaseTableHierNumberedTitle for hierarchically numbered tables. The BaseTable reporter specifies which template to use by setting this reporter's TemplateSrc property to the BaseTable template and this reporter's TemplateName property to the title template name.

The owner can also generate a hyperlink target in front of the title by setting this reporter's LinkTarget property to the id of the link target.

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

Properties

expand all

ID of hole to be filled by this reporter, specified as a string.

Content of hole to be filled by this reporter, specified as one of these values:

  • String or character array

  • 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 arrays, and/or DOM objects

Prefix for the title content, 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 the title content, 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.

Title translations, specified as a MATLAB® structure. The structure contains three fields that are empty by default:

  • Translations.NumberPrefixSuffix

    If this field is empty (the default value), the title number prefixes and suffixes are not translated. To generate localized versions of the title number prefix and suffix, the title owner sets this field to a MATLAB containers.MAP object that maps a locale key to a structure that contains the translations of the NumberPrefix and Numbersuffix properties. The value structure must contain these fields:

    • Locale — ID of the locale, for example, 'en'

    • TitleNumberPrefix — Locale-specific number prefix, for example, 'Chapter'

    • TitleNumberSuffix — Locale-specific number suffix, for example, '. '

  • Translations.Content

    If this field is empty (the default value), the title content is not translated. To generate localized versions of the title content, the title reporter owner sets this field to a MATLAB containers.Map object that maps a locale key to the translation of the title content. If the value of this field is not empty and the value of the Content property of this reporter is empty, this reporter uses the content map to look up a localized version of the title content.

  • Translations.Owner

    This property is used to find a default title content translation specified by the title owner reporter. This property is for internal use only.

If the specified translation map does not contain a translation for the specified report locale, the en locale is used as the locale for the title, prefix, and suffix. See the Locale property of mlreportgen.report.Report for information about valid locales.

Source of the template for this reporter, specified as one of these options:

  • 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 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 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