Main Content

mlreportgen.dom.TableColSpecGroup class

Package: mlreportgen.dom

Define style for group of table columns

Description

Use an object of the mlreportgen.dom.TableColSpecGroup class to define the style for a group of adjacent table columns. To override the style specified by a TableColSpecGroup object for one or more adjacent columns of the group, use an mlreportgen.dom.TableColSpec object.

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

Class Attributes

ConstructOnLoad
true
HandleCompatible
true

For information on class attributes, see Class Attributes.

Creation

Description

example

colSpecGroupObj = mlreportgen.dom.TableColSpecGroup() creates a column style specification that spans an entire table.

Properties

expand all

Number of adjacent table columns to which the column formatting applies, specified as an integer. If the value of the Span property is empty ([]), the formatting applies to all of the columns in the table.

Column formatting, specified as an array of format objects. Format objects that do not apply to a TableColSpecGroup object are ignored.

Styles for column subgroups, specified as an array of mlreportgen.dom.TableColSpec objects. The first mlreportgen.dom.TableColSpec object applies to the first subgroup of the group of columns specified by this TableColSpecGroup object. The second TableColSpec object applies to the next subgroup, and so on. For example, suppose that this TableColSpecGroup object applies to the first five columns of the table and that the first TableColSpec object in the ColSpecs property has a span of two. The first TableColSpec object applies to the first and second columns of the table.

The style specified by a TableColSpec object in the ColSpecs property overrides the style specified by the Style property of this TableColSpecGroup object.

This property is ignored.

Custom attributes of this document element, specified as an array of mlreportgen.dom.CustomAttribute objects. The custom attributes must be supported by the report output format.

This property is ignored and is read-only.

This property is ignored and is read-only.

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

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

Examples

collapse all

Make the first column of a table green and the remaining columns red. Use a TableColSpecGroup object to specify the color of all of the table columns and use a TableColSpec object to override the color for the first column.

import mlreportgen.dom.*
d = Document('mydoc','docx');
append(d,'Table');
     
grps(1) = TableColSpecGroup;
grps(1).Style = {Color('red')};
grps(1).Span = 5;
specs(1) = TableColSpec;
specs(1).Style = {Color('green')};
grps(1).ColSpecs = specs;
table = Table(magic(5));
table.ColSpecGroups = grps;

append(d,table);

close(d);
rptview(d);

Version History

Introduced in R2014b