Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

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 either:

To make text bold, set this property to true or 1. If this property is empty and the StyleName property for this document element specifies a style sheet style, the weight of the text is determined by that style. Setting the Bold property adds a corresponding mlreportgen.dom.Bold format object to the Style property of this document element. Removing the Bold property setting removes the object.

Data Types: logical

Text color, specified as either:

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

The output format must support the custom attributes of this document element.

The name of a font family.

To specify substitutions for this font, do not set this property. Instead create and add a mlreportgen.dom.FontFamily object to the Style property of this document element.

Setting the FontFamilyName property adds a corresponding mlreportGen.dom.FontFamily format object to the Style property for this document element. Setting the FontFamilyName property is the same as setting the FontName property of mlreportgen.dom.FontFamily. Removing the FontFamilyName property setting removes the object.

If you need to specify substitutions for this font, do not set this property. Instead create and add a mlreportgen.dom.FontFamily object to the Style property of this document element.

Setting the FontSize property adds a corresponding mlreportGen.dom.FontSize format object to the Style property for this document element. Removing the FontSize property setting removes the object.

Font size for text, in the form valueUnits, where Units is an abbreviation for the units. Use one of these abbreviations for the units:

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

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

To use italics for text, set this property to true. If this property is empty and the StyleName property for this document element specifies a style sheet style, the slant of the text is determined by that style. Setting the Italic property adds a corresponding mlreportgen.dom.Italic format object to the Style property of this document element. Removing the Italic property setting removes the object.

Data Types: logical

Text strikethrough, specified as one of these values:

  • 'none' — Do not use strikethrough.

  • 'single' — Use a single line for strikethrough.

  • 'double' — Use a double line for strikethrough for Word documents.

Setting the Strike property adds a corresponding mlreportGen.dom.Strike format object to the Style property for this document element. Removing the Strike property setting removes the object.

An array of DOM style 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 document element, specified as a character vector.

A session-unique ID is generated as part of document element creation. The generated tag has the form CLASS:ID, where CLASS is the class of the element and ID is the value of the Id property of the object. You can specify a tag to replace the generated tag.

For example, to make it easier to identify where an issue occurred during document generation, you can specify your own tag value.

You can specify one of the following types of underlines.

Border ValueDescriptionSupported Output Types

'dash'

Dashed underline

Word

'dashedHeavy'

Line with heavy dashes

Word

'dashLong'

Line with long dashes

Word

'dashLongHeavy'

Line with heavy long dashes

Word

'dashDotDotHeavy'

Line with heavy dashes with two dots between the dashes

Word

'dashDotHeavy'

Heavy dash-dot line

Word

'dotted'

Dotted line

Word

'dottedHeavy'

Thick dotted line

Word

'dotDash'

Dot-dash line

Word

'dotDotDash'

Dot-dot-dash line

Word

'dashDotHeavy'

Heavy dot-dash line

Word

'double'

Double line

Word

'none'

Do not use underlining

All output types

'single'

Single line

All output types

'thick'

Thick line

Word

'wave'

Wavy line

Word

'waveyDouble'

Double wavy line

Word

'waveyHeavy'

Heavy wavy

Word

'words'

Underline non-space characters only

Word

If this property is empty and StyleName property of this document element specifies a style sheet style, the type of underline is determined by that style.

To specify the color as well as the type of the underline, do not set the Underline property. Instead, set the Style property of this document element to include an mlreportgen.dom.Underline format object that specifies the desired underline type and color.

Setting the Underline property adds a corresponding mlreportgen.dom.Underline format object to the Style property for this document element. Removing the Underline property setting removes the object.

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

Was this topic helpful?