Package: mlreportgen.dom
Superclasses:
Create Heading1 paragraph
Create an mlreportgen.dom.Heading1
paragraph
object.
creates
an empty headingObj
= Heading1()Heading1
object.
creates
the heading containing the specified text.headingObj
= Heading1(text
)
creates
the heading using the specified style.headingObj
= Heading1(text
,styleName
)
creates
the heading containing the specified DOM object.headingObj
= Heading1(domObj
)
text
— Heading textHeading text, specified as a character vector.
styleName
— Style for the headingThe name of a style, specified as a character vector. The style must be defined in the template used to create the document that contains this heading.
domObj
— DOM object to include in headingmlreportgen.dom.ExternalLink
object | mlreportgen.dom.Image
object | mlreportgen.dom.InternalLink
object | mlreportgen.dom.LinkTarget
object | mlreportgen.dom.Text
objectDOM object to include in the heading, specified as any of these DOM object types:
ExternalLink
Image
InternalLink
LinkTarget
Text
BackgroundColor
— Background color[]
(default) | character vector | string scalarBackground 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'
Bold
— Whether to use bold for text[]
(default) | true
or 1
| false
or 0
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.
Children
— Children of document elementChildren of this document element, specified as an array of DOM objects. This property is read-only.
Color
— Text color[]
(default) | character vector | string scalarText 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'
CustomAttributes
— Custom attributes of this elementmlreportgen.dom.CustomAttribute
objectsCustom attributes of this element, specified as an array of mlreportgen.dom.CustomAttribute
objects.
Use custom attributes supported by the output format.
FirstLineIndent
— Indentation amount for first line of paragraph[]
| character vector | string scalarIndentation amount for the fist line of this paragraph, specified as a character vector or string scalar that consists of number followed by an abbreviation for a unit of measurement. For example, '0.5in' specifies one-half inch. Valid abbreviations are:
px
— pixels (default)
cm
— centimeters
in
— inches
mm
— millimeters
pc
— picas
pt
— points
The indentation amount is the amount by which to indent the first line of this paragraph relative to the succeeding lines. To create a hanging indent where all of the lines are indented except for the first line, use a negative number.
Setting the FirstLineIndent
property adds a corresponding
mlreportgen.dom.FirstLineIndent
format object to the
Style
property for this document element. Setting the
FirstLineIndent
property to an empty value removes the
object.
Example: '0.5in'
FontFamilyName
— Name of font family for text[]
| character vector | string scalarName 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'
FontSize
— Font size for text[]
(default) | character vector | string scalarFont 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
— ID for this document elementID 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.
Italic
— Whether to use italic for text[]
(default) | true
or 1
| false
or 0
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.
OuterLeftMargin
— Left indentation for paragraph[]
| character vector | string scalarLeft indentation for this paragraph, specified as a character vector or string scalar that consists of a number followed by a unit of measurement. For example, '0.5in' specifies one-half inch. Valid abbreviations are:
px
— pixels (default)
cm
— centimeters
in
— inches
mm
— millimeters
pc
— picas
pt
— points
The left indentation is the space between the left outer boundary of this paragraph and the left inner boundary of its container. This is equivalent to the left indentation property of a Microsoft® Word paragraph.
Setting the OuterLeftMargin
property adds a corresponding
mlreportGen.dom.OuterMargin
format object to the
Style
property for this document element. Setting the
OuterLeftMargin
property to an empty value removes the
object.
To indent a paragraph from both the left and right margin of a page, do not set this property.
Instead, create an mlreportgen.dom.OuterMargin
that specifies the
left and right indentations and add the object to the Style
property
of this paragraph.
OutlineLevel
— Outline level of paragraph[]
(default) | integerOutline level of the paragraph, specified as an integer. Setting the
OutlineLevel
property causes this paragraph to be included in
automatically generated outlines, such as a table of contents. The value specifies the
level of the paragraph in the outline. For example, to make a paragraph appear at the
top level in an outline, set the OutlineLevel
property to
1
.
Setting the OutlineLevel
property adds a corresponding
mlreportgen.dom.OutlineLevel
format object to the
Style
property. Setting the OutlineLevel
property to an empty value removes the object.
Parent
— Parent of document elementParent of this document element, specified as a DOM object. This property is read-only.
Strike
— Text strikethrough'none'
| 'single'
| '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.
Style
— Format specificationFormat objects that specify the format of a document element.
StyleName
— Style to apply from style sheetName of the style to apply from the style sheet, specified as a character vector.
Tag
— Tag for this document elementTag 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.
Underline
— Type of underline[]
(default) | 'single'
| 'none'
| ...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 with two dots between the dashes | Word |
| Wavy line | Word |
| Heavy wavy | Word |
| Double wavy line | Word |
| 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.
WhiteSpace
— How to treat white space in text[]
(default) | 'normal'
| 'nowrap'
| ...How to treat white space in text, specified as one of the values in this table.
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 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 |
| 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 |
| 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.
This example shows how to add three levels of headings, each formatted according to its level. This example inserts three heading objects into a document: a Heading1
, a Heading2
, and a Heading3
.
import mlreportgen.dom.*; d = Document('mydoc','docx'); open(d); title = append(d, Paragraph('Document Title')); title.Bold = true; title.FontSize = '28pt'; h1 = append(d,Heading1('Chapter 1')); h1.Style = {PageBreakBefore(true)}; p1 = append(d,Paragraph('Hello World')); h2 = append(d,Heading2('Section 1.1')); p2 = append(d,Paragraph('Text for this section.')); h3 = append(d,Heading3('My Subsection 1.1.a')); p3 = append(d,Paragraph('Text for this subsection')); close(d); rptview(d.OutputPath);
mlreportgen.dom.Heading
| mlreportgen.dom.Heading2
| mlreportgen.dom.Heading3
| mlreportgen.dom.Heading4
| mlreportgen.dom.Heading5
| mlreportgen.dom.Heading6
| mlreportgen.dom.Paragraph
You have a modified version of this example. Do you want to open this example with your edits?