mlreportgen.dom.Text class

Package: mlreportgen.dom
Superclasses:

Description

Text to include in a document element

Construction

textObj = Text() creates an empty text object.

textObj = Text(text) creates a text object containing the specified text.

textObj = Text(text,styleName) creates a text object containing the specified text using the specified style. The style must be defined in the style sheet of the template of the document to which this text object is appended.

Input Arguments

expand all

Array of chars containing the text

Data Types: char

The style specified by styleName must be defined in the template used to create the document to which this text is appended.

Data Types: char

Output Arguments

expand all

Text, returned as an mlreportgen.dom.Text object.

Properties

expand all

Background color, specified as a character vector or string scalar that consists of a CSS color name (see https://www.crockford.com/wrrrld/color.html) or a hexadecimal RGB (truecolor) value in the form #RRGGBB.

Setting the BackgroundColor property adds a corresponding mlreportgen.dom.BackgroundColor format object to the Style property. Setting the BackgroundColor property to an empty value removes the object.

Example: 'blue'

Example: '#0000ff'

Whether to use bold for text, specified as a numeric or logical 1 (true) or 0 (false). To make text bold, set Bold to true or 1.

Setting the Bold property adds a corresponding mlreportgen.dom.Bold format object to the Style property. Setting the Bold property to an empty value removes the object.

Text color, specified as a character vector or string scalar that consists of a CSS color name (see https://www.crockford.com/wrrrld/color.html) or a hexadecimal RGB (truecolor) value in the form #RRGGBB.

Setting the Color property adds a corresponding mlreportgen.dom.Color format object to the Style property. Setting the Color property to an empty value removes the object.

Example: 'blue'

Example: '#0000ff'

Text contained by this document element, specified as a character vector.

Custom attributes of this document element, specified as an array of mlreportgen.dom.CustomAttribute objects. The custom attributes must be supported by the output format.

Name of a font family to use for text, specified as a character vector or string scalar.

Setting the FontFamilyName property adds a corresponding mlreportgen.dom.FontFamily format object to the Style property. Setting the FontFamilyName property is the same as setting the FontName property of an mlreportgen.dom.FontFamily object. Setting the FontFamilyName property to an empty value removes the object.

To specify substitutions for the font, do not specify the font family by setting this property. Instead create and add an mlreportgen.dom.FontFamily object to the Style property.

Example: 'Courier New'

Font size to use for text, specified as a character vector or string scalar that consists of a number followed by an abbreviation for a unit of measurement. For example, '12pt' specifies twelve points. Valid abbreviations are:

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

Setting the FontSize property adds a corresponding mlreportgen.dom.FontSize format object to the Style property. Setting the FontSize property to an empty value removes the object.

Example: '12pt'

ID for this document element, specified as a character vector or string scalar. The DOM generates a session-unique ID when it creates the document element. You can specify your own ID.

Whether to use italic for text, specified as a numeric or logical 1 (true) or 0 (false). To make text italic, set Italic to true or 1.

Setting the Italic property adds a corresponding mlreportgen.dom.Italic format object to the Style property. Setting the Italic property to an empty value removes the object.

Text strikethrough, specified as one of these values:

  • 'none' — No strikethrough

  • 'single' — Single line

  • 'double' — Double line (for Word reports only)

Setting the Strike property adds a corresponding mlreportgen.dom.Strike format object to the Style property for this document element. Setting the Strike property to an empty value removes the object.

A cell array of DOM format objects that specifies the format for the text.

The style specified by StyleName must be defined in the template used to create the document element to which this text is appended.

Tag for this document element, specified as a character vector or string scalar.

The DOM generates a session-unique tag as part of the creation of this object. The generated tag has the form CLASS:ID, where CLASS is the object class and ID is the value of the Id property of the object. Specifying your own tag value can help you to identify where an issue occurred during document generation.

Type of underline, specified as one of the values in this table.

Underline valueDescriptionSupported Output Types

'single'

Single line

All

'words'

Underline all characters except spaces

Word

'double'

Double line

Word

'thick'

Thick line

Word

'dotted'

Dotted line

Word

'dottedHeavy'

Thick dotted line

Word

'dash'

Dashed line

Word

'dashedHeavy'

Line with heavy dashes

Word

'dashLong'

Line with long dashes

Word

'dashLongHeavy'

Line with heavy long dashes

Word

'dotDash'

Dot-dash line

Word

'dashDotHeavy'

Heavy dash-dot line

Word

'dotDotDash'

Dot-dot-dash line

Word

'dashDotDotHeavy'

Line with heavy dashes with two dots between the dashes

Word

'wave'

Wavy line

Word

'wavyHeavy'

Heavy wavy

Word

'wavyDouble'

Double wavy line

Word

'none'

No underline

All

Setting the Underline property adds a corresponding mlreportgen.dom.Underline format object to the Style property. Setting the Underline property to an empty value removes the object.

To specify both the color and the type of the underline, do not set the Underline property. Instead, set the Style property to include an mlreportgen.dom.Underline format object that specifies the underline type and color.

To specify how to handle white space, use one of these values. The WhiteSpace property does not apply to PDF format for Text objects.

ValueDescriptionSupported Output Types

'normal'

Does not preserve white space and line breaks

Word and HTML

'nowrap'

Sequences of white space collapse into a single white space. Text never wraps to the next line.

HTML

'preserve'

Preserves white space. Text wraps when necessary and on line breaks. Acts like the <pre-wrap> setting in HTML.

Word and HTML

See below for details.

'pre'

Preserves white space. Text wraps only on line breaks. Acts like the <pre> setting in HTML.

HTML

'pre-line'

Sequences of white space collapse into a single white space. Text wraps.

HTML

'pre-wrap'

Preserves white space. Text wraps when necessary and on line breaks

HTML

If you want to view HTML output in the MATLAB® browser and you want to preserve white space and wrap text only on line breaks, use the preserve setting rather than the pre setting.

Setting the WhiteSpace property adds a corresponding WhiteSpace format object to Style property. Removing the WhiteSpace property setting removes the WhiteSpace object.

Methods

Use the Text.append and Text.clone methods the same way you use the Paragraph.append and Paragraph.clone methods.

Method

Purpose

append

Append a custom element to this text object.

clone

Clone this text object