mlreportgen.dom.CharEntity Class
Namespace: mlreportgen.dom
Superclasses: mlreportgen.dom.Text
Create character entity reference
Description
Use an object of the mlreportgen.dom.CharEntity class to create a reference to a character entity reference.
To see what DOM objects you can append an mlreportgen.dom.CharEntity object
to, see Append mlreportgen.dom.CharEntity object to DOM class object.
The mlreportgen.dom.CharEntity class is a handle class.
Creation
Description
creates a reference to a non-breaking space ( ) entity.
Appending this reference to a document inserts a non-breaking
space.charEntityObj = CharEntity
creates a reference to the character entity specified by
charEntityObj = CharEntity(name)name.
Input Arguments
Character entity name, specified as a character vector or string scalar. For a list of valid character entry names, see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references.
Note
CharEntity supports character
entity names from HTML 4.01 or earlier.
Example: "amp"
Example: "pound"
Data Types: char | string
Number of character entities to use, specified as an integer.
Data Types: uint16
Properties
Name of character entity, specified as a character vector or string scalar. For a list of valid character entry names, see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references.
Note
CharEntity supports character entity
names from HTML 4.01 or earlier.
Example: "amp"
Example: "pound"
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Text contained by this document element, specified as a character vector or string scalar.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Background color, specified as a character vector or string scalar that contains a CSS color name, hexadecimal RGB value, or decimal RGB value.
| Format | Value |
|---|---|
| CSS color name | Specify a CSS color name. For a list of CSS color names, see https://www.w3.org/wiki/CSS/Properties/color/keywords. |
| Hexadecimal RGB value | Use the format "#RRGGBB". Use # as the first character
and two-digit hexadecimal numbers for the red, green, and blue values. You can
use uppercase or lowercase letters. |
| Decimal RGB color value | Use the format "rgb(r,g,b)", where r,
g, and b are comma-separated positive
integers that specify the red, green, and blue values, respectively. Each value
range must be between 0 and 255. |
Setting the BackgroundColor property adds a
mlreportgen.dom.BackgroundColor format object to the
Style property. Setting the BackgroundColor
property to an empty value removes the object.
Example: "red" specifies a red color using a CSS color
name.
Example: "#0000ff" specifies a blue color using a hexadecimal RGB value.
Example: "rgb(128,0,128)" specifies a purple color using a decimal RGB color value.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Whether to use bold for this document element, specified as a logical 1
(true) or 0 (false). When you
specify:
1(true) — Render document element in bold text.0(false) — Render document element in regular weight.
Note
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.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: logical
Document element object color, specified as a character vector or string scalar that contains a CSS color name, hexadecimal RGB value, or decimal RGB value.
| Format | Value |
|---|---|
| CSS color name | Specify a CSS color name. For a list of CSS color names, see https://www.w3.org/wiki/CSS/Properties/color/keywords. |
| Hexadecimal RGB value | Use the format "#RRGGBB". Use # as the first character
and two-digit hexadecimal numbers for the red, green, and blue values. You can
use uppercase or lowercase letters. |
| Decimal RGB color value | Use the format "rgb(r,g,b)", where r,
g, and b are comma-separated positive
integers that specify the red, green, and blue values, respectively. Each value
range must be between 0 and 255. |
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: "red" specifies a red color using a CSS color name.
Example: "#0000ff" specifies a blue color using a hexadecimal RGB value.
Example: "rgb(128,0,128)" specifies a purple color using a decimal RGB color value.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Whether to use italic for document element, specified as a logical 1
(true) or 0 (false). When you
specify:
1(true) — Render document element in italic text.0(false) — Render document element in straight text.
Note
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.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: logical
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.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Type of underline, specified as one of the values in this table.
| Underline value | Description | Supported Output Types |
|---|---|---|
| Single line | All |
| Underline all characters except spaces | Word |
| Double line | Word |
| Thick line | Word |
| Dotted line | Word |
| Thick dotted line | Word |
| Dashed line | Word |
| Line with heavy dashes | Word |
| Line with long dashes | Word |
| Line with heavy long dashes | Word |
| Dot-dash line | Word |
| Heavy dash-dot line | Word |
| Dot-dot-dash line | Word |
| Line with heavy dashes and two dots between the dashes | Word |
| Wavy line | Word |
| Heavy wavy | Word |
| Double wavy line | Word |
| No underline | All |
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.
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.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Name of a font family to use for text, specified as a character vector or string scalar. 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.
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.
Example: "Courier New"
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
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.
Font size, specified as a character vector or string scalar that contains a number followed by an abbreviation for a unit of measurement. Valid abbreviations are:
"px"— Pixels"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 for this
document element. Removing the FontSize
property setting removes the object.
Example: "10pt" specifies 10
points
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Number of times to repeat character entity, specified as a numeric value.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: uint32
How to treat white space and line breaks in text, specified as one of the values in
this table. The WhiteSpace property does not apply when the
Type property of the Document object is
PDF.
| Value | Description | Supported Output Types |
|---|---|---|
| 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 Microsoft® Word, this value removes spaces at the beginning and end of text. | All |
| Sequences of white space collapse into a single white space. Text never wraps to the next line. | HTML |
| Preserves white space. Text wraps only on line breaks. Acts
like the | HTML and PDF |
| Same as "pre". | All |
| Sequences of white space collapse into a single white space. Text wraps when necessary and on line breaks. | HTML and PDF |
| Preserves white space. Text wraps when necessary and on line breaks. | HTML and PDF |
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.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Name of stylesheet-defined style, specified as a character vector or string scalar.
The style name is the name of a style specified in the style sheet of the document or
document part to which this element is appended. The specified style defines the
appearance of this element in the output document unless the formats specified by the
Style property of this element override it. To learn more about
using style sheets, see Use Style Sheet Styles.
Note
Microsoft Word reports ignore style names that are not defined in the document template. For more information on Microsoft Word templates, see Templates for DOM API Report Programs.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Format specification for this document element object, specified as a cell array of
DOM format objects. The formats specified by this property override corresponding
formats specified by the StyleName property of this element.
Formats that do not apply to this document element object are ignored.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: cell
Custom attributes of the document element, specified as an array of mlreportgen.dom.CustomAttribute objects. The custom attributes must be
supported by the output format of the document element to which this object is
appended.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Tag, specified as a character vector or string scalar. The DOM API 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. Use this value to help identify
where an issue occurs during document generation.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Object identifier, specified as a character vector or string scalar. The DOM API generates a session-unique identifier when it creates the document element object.
Attributes:
GetAccess | public |
SetAccess | public |
NonCopyable | true |
Data Types: char | string
Methods
Method | Purpose |
|---|---|
clone |
Note Do not append the same object to a document more than once. Use clone to create a copy when you want to reuse the same content elsewhere in a document. Input Arguments
Return Values
For more information, see the equivalent method for the
|
Examples
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);
Limitations
CharEntitysupports character entity names from HTML 4.01 or earlier.
More About
You can append an mlreportgen.dom.CharEntity object to
these DOM class objects:
mlreportgen.dom.Endnote(since R2024a)mlreportgen.dom.Footnote(since R2024a)mlreportgen.dom.HTMLPage(since R2024a)mlreportgen.dom.TemplateDocumentPart(since R2023b)
Algorithms
Using this class on HTML templates that you define with a mlreportgen.dom.Template object
adds the equivalent numeric character reference instead of the character entity
reference.
Version History
Introduced in R2014b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)