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.Table class

Package: mlreportgen.dom
Superclasses:

Create table

Description

Use an mlreportgen.dom.Table object to define a table. Append rows and table entries to add content to the table. You can define column properties.

Construction

tableObj = Table(nCols) creates an empty table having the specified number of columns. Use this constructor as the starting point for creating a table from scratch.

tableObj = Table(array) returns a table whose content is specified by an array. The constructor converts basic MATLAB® types to corresponding DOM types, e.g., character vectors to Text objects.

tableObj = Table(array,style) creates a table having the specified style. The style specified by style must be defined in the template used to create the document to which this table is appended.

Input Arguments

expand all

Number of table columns, specified as a double.

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

Style for table, specified as a character vector. The specified style must be defined in the template used by the document you append this table to.

Output Arguments

expand all

Table, represented by an mlreportgen.dom.Table object.

Properties

expand all

Background color, specified as either:

Type of border to draw, specified as one of these values.

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

See discussion below this table.

HTML and PDF

'inset'

3-D effect line

All output types

'none'

No line

See discussion below this table.

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

This read-only property lists child elements of this object.

The style of the line separating the columns of a table or table section (header, body, footer), as specified by a 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.

Direction for text to flow, specified as one of these values:

  • 'ltr' — flow from left to right

  • 'rtl' — flow from right to left

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

  • 'center'

  • 'left'

  • 'right'

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.

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

This read-only property lists the parent of this document element.

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.

Color of lines separating table rows, specified as one of these values:

  • The name of a color. See the mlreportGen.dom.Color class reference page for a list of supported colors.

  • A hexadecimal RGB (truecolor) value as #RRGGBB. For example, #0000ff is a shade of blue.

Width of lines separating table rows in the form valueUnits, where Units is an abbreviation for the units. Use one of these abbreviations:

  • 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.

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

  • 'center'

  • 'left'

  • 'right'

Data Types: char

Vertical alignment of table cell content, specified as one of these values:

  • 'top'

  • 'middle'

  • 'bottom'

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

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

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.

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

Method

Purpose

append

Append a content to a table.

clone

Clone this table.

entry

Get a table entry.

row

Create a table row.

Examples

expand all

import mlreportgen.dom.*;
d = Document('myreport','html');
open(d);

t = Table(magic(5));
t.Style = {RowHeight('1in')};
t.Border = 'solid';
t.BorderWidth = '1px';
t.ColSep = 'solid';
t.ColSepWidth = '1';
t.RowSep = 'solid';
t.RowSepWidth = '1';

% Set this property first to prevent overwriting alignment properties
t.TableEntriesStyle = {FontFamily('Arial'),Width('1in'),Color('red'),Bold};
t.TableEntriesHAlign = 'center';
t.TableEntriesVAlign = 'middle';

append(d,t);
close(d);
rptview(d.OutputPath);
Was this topic helpful?