mlreportgen.dom.TemplateTableStyle Class
Namespace: mlreportgen.dom
Description
Use this class to create a Document Object Model (DOM) representation of a table style.
The mlreportgen.dom.TemplateTableStyle
class is a handle
class.
Creation
Description
creates a
table style with an empty name. You must set the styleObj
= TemplateTableStyleName
property to
use the style.
creates a table style and initializes the styleObj
= TemplateTableStyle(name
)Name
property to
name
. Add an instance of this object to the style sheet of the
template specified by its Stylesheet
property, to use this style to
format tables based on the template. Set the StyleName
property of
the table to the name of this style to format the table as defined by the style.
Properties
Name
— Name of style
''
(default) | character vector | string scalar
Name of the style, specified as a string scalar or character vector.
Note
The name must include only letters, numbers, hyphens (-
), and
underscores (_
).
Attributes:
NonCopyable | true |
Data Types: char
| string
Formats
— Style sheet formats
[]
(default) | array of DOM formatting objects
Style sheet formats, specified as an array of DOM formatting objects. These formats define how this style affects report content.
Attributes:
NonCopyable | true |
TableEntryFormats
— Table entry formats
[]
(default) | array of DOM formatting objects
Table entry formats, specified as an array of DOM formatting objects. These formats apply to every table entry in tables that use this style.
Attributes:
NonCopyable | true |
HeaderFormats
— Table header formats
[]
(default) | array of DOM formatting objects
Table header formats, specified as an array of DOM formatting objects. These formats apply to every table header in tables that use this style.
Attributes:
NonCopyable | true |
FooterFormats
— Table footer formats
[]
(default) | array of DOM formatting objects
Table footer formats, specified as an array of DOM formatting objects. These formats apply to every table footer in tables that use this style.
Attributes:
NonCopyable | true |
FirstColumnFormats
— First column of a table formats
[]
(default) | array of DOM formatting objects
First column of a table formats, specified as an array of DOM formatting objects. These formats apply to the first column of tables that use this style.
Note
The PDF template output ignores this property.
Attributes:
NonCopyable | true |
LastColumnFormats
— Last column of a table formats
[]
(default) | array of DOM formatting objects
Last column of a table formats, specified as an array of DOM formatting objects. These formats apply to the first column of tables that use this style.
Note
The PDF template output ignores this property.
OddColumnFormats
— Odd columns of a table formats
[]
(default) | array of DOM formatting objects
Odd columns of a table formats, specified as an array of DOM formatting objects. These formats apply to the first column of tables that use this style.
Note
The PDF template output ignores this property.
Attributes:
NonCopyable | true |
EvenColumnFormats
— Even columns of a table formats
[]
(default) | array of DOM formatting objects
Even columns of a table formats, specified as an array of DOM formatting objects. These formats apply to the first column of tables that use this style.
Note
The PDF template output ignores this property.
Attributes:
NonCopyable | true |
OddRowFormats
— Odd rows of a table formats
[]
(default) | array of DOM formatting objects
Odd rows of a table formats, specified as an array of DOM formatting objects. These formats apply to the first column of tables that use this style.
Note
The PDF template output ignores this property.
Attributes:
NonCopyable | true |
EvenRowFormats
— Even rows of a table formats
[]
(default) | array of DOM formatting objects
Even rows of a table formats, specified as an array of DOM formatting objects. These formats apply to the first column of tables that use this style.
Note
The PDF template output ignores this property.
Attributes:
NonCopyable | true |
TopLeftEntryFormats
— Top left entry of a table formats
[]
(default) | array of DOM formatting objects
Top left entry of a table formats, specified as an array of DOM formatting objects. These formats apply to the first column of tables that use this style.
Note
The PDF template output ignores this property.
Attributes:
NonCopyable | true |
TopRightEntryFormats
— Top right entry of a table formats
[]
(default) | array of DOM formatting objects
Top right entry of a table formats, specified as an array of DOM formatting objects. These formats apply to the first column of tables that use this style.
Note
The PDF template output ignores this property.
Attributes:
NonCopyable | true |
BottomLeftEntryFormats
— Bottom left entry of a table formats
[]
(default) | array of DOM formatting objects
Bottom left entry of a table formats, specified as an array of DOM formatting objects. These formats apply to the first column of tables that use this style.
Note
The PDF template output ignores this property.
Attributes:
NonCopyable | true |
BottomRightEntryFormats
— Bottom right entry of a table formats
[]
(default) | array of DOM formatting objects
Bottom right entry of a table formats, specified as an array of DOM formatting objects. These formats apply to the first column of tables that use this style.
Note
The PDF template output ignores this property.
Attributes:
NonCopyable | true |
Tag
— Tag for mlreportgen.dom.TemplateTableStyle
object
character vector | string scalar
Tag for the mlreportgen.dom.TemplateTableStyle
object, 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. Specify your own tag value to help
you identify where to look when an issue occurs during document generation.
Attributes:
NonCopyable | true |
Data Types: char
| string
Id
— Object identifier for mlreportgen.dom.TemplateTableStyle
object
character vector | string scalar
Object identifier for the mlreportgen.dom.TemplateTableStyle
object, specified as a
character vector or string scalar. The DOM API generates a session-unique identifier
when it creates the document element object. You can specify your own value for
Id
.
Attributes:
NonCopyable | true |
Data Types: char
| string
Examples
Create and Use Style for Table in Template
Create a table style in a template and then apply that style in your document.
Create the style
Import the DOM API namespace so that you do not have to use fully qualified names.
import mlreportgen.dom.*; t = Template("myTemplate","html"); open(t);
Create a table style.
tableStyle = TemplateTableStyle("myTableStyle");
Define formats for the table style.
tableStyle.Formats = [Border("solid"), ColSep("solid"), RowSep("solid")]; tableStyle.OddRowFormats = [BackgroundColor("lightblue")];
Add the style to the style sheet.
addStyle(t.Stylesheet,tableStyle);
Close the template.
close(t);
Use the style from the template in a document
Create a document using the generated template.
d = Document("myDoc","html","myTemplate"); open(d);
Create a table object.
tbl = Table(randi(10,[4 4]));
Set the style name.
tbl.StyleName = "myTableStyle";
Add the table to the document.
append(d,tbl);
Close and view the document.
close(d); rptview(d);
Version History
Introduced in R2024a
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)