Main Content

mlreportgen.dom.FormalTable class

Package: mlreportgen.dom

Formal table

Description

Defines a formal table, which is a table that has a body and optionally a table header, a table footer, or both. The table header, body, and footer are mlreportgen.dom.TableHeader, mlreportgen.dom.TableBody, and mlreportgen.dom.TableFooter objects, respectively.

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

Creation

Description

formalTableObj = FormalTable() creates an empty formal table. Use this constructor as the starting point to create a formal table from scratch.

formalTableObj = FormalTable(ncols) creates an empty formal table having the specified number of columns.

formalTableObj = FormalTable(body) creates a formal table with the body content specified. The constructor converts basic MATLAB® types to corresponding DOM objects. For example, the constructor converts character vectors to mlreportgen.dom.Text objects.

formalTableObj = FormalTable(body,styleName) creates a formal table having the specified body content and style.

formalTableObj = FormalTable(header,body) creates a formal table with a header and a body using the specified contents, and an empty footer.

formalTableObj = FormalTable(header,body,styleName) creates a formal table using the specified content and style. The table has an empty footer.

formalTableObj = FormalTable(header,body,footer) creates a formal table with the specified content for the body, header, and footer.

Input Arguments

expand all

Number of columns in a table, specified as a numeric value.

Data Types: double

Table body content, specified as:

  • A two-dimensional numeric array

  • A two-dimensional categorical array

  • A two-dimensional cell array that can contain:

    • Character vectors

    • One- or two-dimensional cell array

    • double

    • mlreportgen.dom.Text object

    • mlreportgen.dom.Paragraph object

    • mlreportgen.dom.Image object

    • mlreportgen.dom.Table object

    • mlreportgen.dom.FormalTable object

    • mlreportgen.dom.OrderedList object

    • mlreportgen.dom.UnorderedList object

    • mlreportgen.dom.ExternalLink object

    • mlreportgen.dom.InternalLink object

    • mlreportgen.dom.CharEntity object

The style specified by styleName must be defined in the template used to create the document that contains this table.

The cell array may contain:

  • Character vectors

  • One- or two-dimensional cell array

  • double

  • mlreportgen.dom.Text object

  • mlreportgen.dom.Paragraph object

  • mlreportgen.dom.Image object

  • mlreportgen.dom.Table object

  • mlreportgen.dom.FormalTable object

  • mlreportgen.dom.OrderedList object

  • mlreportgen.dom.UnorderedList object

  • mlreportgen.dom.ExternalLink object

  • mlreportgen.dom.InternalLink object

  • mlreportgen.dom.CharEntity object

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'

The table constructor creates a table body object and assigns it to this property when the formal table is constructed. You cannot subsequently set this property. However, you can append content to the table body and set its properties via this property.

Type of border to draw, specified as one of the values in the table.

Border ValueDescriptionSupported Output Types

'dashed'

Dashed line

All output types

'dashdotstroked'

Line with alternating diagonal dashes and dot

Word

'dashsmallgap'

Dashed line with a small gap between dashes

Word

'dotted'

Dotted line

All output types

'dotdash'

Line with alternating dots and dashes

Word

'dotdotdash'

Line with alternating double dots and a dash

Word

'double'

Double line

All output types

'doublewave'

Double wavy line

Word

'groove'

3-D effect grooved line

HTML and PDF

'hidden'

No line

The 'none' border type also produces no line. However, conflicting borders are handled differently for 'hidden' types than for 'none' types. The 'hidden' border type takes precedence over a conflicting border type. A conflicting border type takes precedence over the 'none' type.

HTML and PDF

'inset'

3-D effect line

All output types

'none'

No line

The 'hidden' border type also produces no line. However, conflicting borders are handled differently for 'hidden' types than for 'none' types. The 'hidden' border type takes precedence over a conflicting border type. A conflicting border type takes precedence over the 'none' type.

All output types

'outset'

3-D effect line

All output types

'ridge'

3-D effect ridged line

HTML and PDF

'single'

Single line

Word

'solid'

Single line

HTML and PDF

'thick'

Thick line

Word

'thickthinlargegap'

Dashed line with alternating thick and thin dashes with a large gap

Word

'thickthinmediumgap'

Dashed line with alternating thick and thin dashes with a medium gap

Word

'thickthinsmallgap'

Dashed line with alternating thick and thin dashes with a small gap

Word

'thinthicklargegap'

Dashed line with alternating thin and thick dashes with a medium gap

Word

'thinthickmediumgap'

Dashed line with alternating thin and thick dashes, with a medium gap

Word

'thinthicksmallgap'

Dashed line with alternating thin and thick dashes with a small gap

Word

'thinthickthinlargegap'

Dashed line with alternating thin and thick dashes with a large gap

Word

'thinthickthinmediumgap'

Dashed line with alternating thin and thick dashes with a medium gap

Word

'thinthickthinsmallgap'

Dashed line with alternating thin and thick dashes with a small gap

Word

'threedemboss'

Embossed effect line

Word

'threedengrave'

Engraved effect line

Word

'triple'

Triple line

Word

'wave'

Wavy line

Word

A value of 'on' collapses borders of adjacent cells into a single border. A value of 'off' keeps borders of adjacent cells.

Border color, specified as either:

Table border width, specified in the form valueUnits, where Units is an abbreviation for the units. Valid abbreviations are:

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

Children of this document element, specified as an array of DOM objects. This property is read-only.

The style of the line separating the columns of a table or table section (header, body, footer), as specified by an mlreportgen.dom.ColSep object.

See the description of the Border property for a description of the possible values.

Color of line separating columns, specified as either:

Width of the line separating table columns, in the form valueUnits. Use one of these abbreviations for the Units:

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

For example, for a column separator of 3 points, set the ColSepWidth property to '3pt'.

An array of mlreportgen.dom.TableColSpecGroup objects that specifies the width, alignment, and other properties of a group of columns. The first object applies to the first group of columns, the second object to the second group, and so on. Specify the number of columns belonging to each group using the Span property of the TableColSpecGroup object. For example, if the first object has a span of 2, it applies to the first two columns. If the second group has a span of 3, it applies to the next three columns, and so on.

The custom attributes must be supported by the output type of the document to which this document element is appended.

Column flow direction, specified as:

  • 'ltr' — Flow from left to right (column 1 is to the left in the table).

  • 'rtl' — Flow from right to left (column 1 is to the right in the table).

Horizontal alignment of this table, specified as one of these values:

  • 'center'

  • 'left'

  • 'right'

Note

To prevent the overflow of large tables in PDF output, set the Width property.

The table constructor creates a table header object and assigns it to this property when the formal table is constructed. You cannot subsequently set this property. However, you can append content to the table body and set its properties via this property.

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

Whether the table contents stay on the same page, specified as a numeric or logical 1 (true) or 0 (false). The default value is empty and is equivalent to true.

Attributes:

GetAccess
public
SetAccess
public
NonCopyable
true

Data Types: logical

Left indentation in the form valueUnits. Units is an abbreviation for the units. Valid abbreviations are:

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

Parent of this document element, specified as a DOM object. This property is read-only.

Attributes:

GetAccess
public
SetAccess
private
NonCopyable
true

The style of a line separating the rows of a table or table section (header, body, or footer).

See the description of the Border property for a description of the possible values.

You can specify:

Width of the row separator, specified in the form valueUnits where Units is an abbreviation for the units. Valid abbreviations are:

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

Array of format objects (such as Bold objects) that specify the format for this table.

This property overrides corresponding formats defined by the style sheet style specified by the StyleName property.

Name of a style specified in the style sheet of the document or document part to which this table is appended

The style that specifies the appearance of this table in the output document, for formats not specified by Style property.

You can set the StyleName property of any formal table section. Setting StyleName overrides the style specified by the formal table itself. However, if you do this for a Word document, you must explicitly specify the width of each column in a section to ensure that all sections have the same width. Word, unlike HTML and PDF, has no built-in support for formal tables. To handle this, the DOM interface represents a formal table as three tables, one for each section, embedded in a 3x1 table.

Cell array of format objects that specify the format for table entries.

The inner margin is the margin between table cell content and the cell borders in the form valueUnits where Units is an abbreviation for the units. Valid abbreviations are:

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

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

A percentage (for example, '100%') of the page width (minus margins for Word reports) or a number of units of measurement, having the format valueUnits. Units is an abbreviation for the units. These are valid abbreviations:

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

Methods

expand all

Version History

Introduced in R2014b