Main Content

mlreportgen.dom.CharEntity class

Package: mlreportgen.dom
Superclasses: mlreportgen.dom.Text

Create character entity reference

Description

Create a reference to a character entity reference.

The mlreportgen.dom.CharEntity class is a handle class.

Creation

Description

charEntityObj = CharEntity() creates a reference to a non-breaking space ( ) entity. Appending this reference to a document inserts a non-breaking space.

example

charEntityObj = CharEntity(name) creates a reference to the character entity specified by name.

charEntityObj = CharEntity(name,n) creates n references to the character entity specified by name, that is, a character vector of n special characters.

Input Arguments

expand all

Number of character entities to use, specified as an integer.

Data Types: uint16

Properties

expand all

Background color, specified as a character vector or string scalar that consists of a CSS color name (see https://www.w3.org/wiki/CSS/Properties/color/keywords) 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'

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 number 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 a character vector or string scalar that consists of a CSS color name (see https://www.w3.org/wiki/CSS/Properties/color/keywords) 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'

If you need to specify substitutions for this font, do not set this property. Instead create and add an 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, specified as a character vector in the form valueUnits. Units is an abbreviation for the units. Use one of these abbreviations for the units for the font size.

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

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.

Attributes:

GetAccess
public
SetAccess
public
NonCopyable
true

Data Types: char | string

To use italics for a number, 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 number 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

The name is a character entity listed in https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references.

Data Types: logical

Number of times to repeat character entity, specified as a numeric value.

Data Types: double

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.

An array of format objects that specifies the format for the number.

The style specified by styleName must be defined in the template used to create the document element to which this number 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.

Attributes:

GetAccess
public
SetAccess
public
NonCopyable
true

Data Types: char | string

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.

How to treat white space in text, specified as one of the values in this table.

ValueDescriptionSupported Output Types

'normal'

For HTML and PDF, this value removes spaces at the beginning and the end of text. Multiple spaces in the text collapse to a single space.

For Word, this value removes spaces at the beginning and end of text.

All

'nowrap'

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

HTML

'pre'

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

HTML and PDF

'pre-line'

Sequences of white space collapse into a single white space. Text wraps when necessary and on line breaks.

HTML and PDF

'pre-wrap'

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

HTML and PDF

'preserve'

Same as 'pre'.All

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

Methods

expand all

Examples

collapse all

import mlreportgen.dom.*;
doctype = 'html';
d = Document('test',doctype);

p = Paragraph(CharEntity('pound'));
append(d,p);
append(p,'3');

close(d);
rptview('test',doctype);
import mlreportgen.dom.*;
doctype = 'html';
d = Document('test',doctype);

p = Paragraph('Some text');
append(d,p);
ce = CharEntity('nbsp',5);
append(p,ce);
append(p,'more text after five blank spaces');

close(d);
rptview('test',doctype);

Version History

Introduced in R2014b