User`s guide
Create and Format Tables
13-69
table = Table(magic(rank));
table.Border = 'single';
table.BorderWidth = '1px';
grps(1) = TableColSpecGroup;
grps(1).Span = rank;
grps(1).Style = {Width('0.2in'),Color('green')};
specs(1) = TableColSpec;
specs(1).Span = 1;
specs(1).Style = {Width('0.5in'),Bold,Color('red')};
grps(1).ColSpecs = specs;
table.ColSpecGroups = grps;
append(rpt,table);
close(rpt);
rptview('test','html');
To have columns resize to fit the widest content of the table entries in a column, include a
ResizeToFitContents object in the Style property of the table.
Create and Format Table Entries
If you need to build a table from scratch, you can use the
mlreportgen.dom.TableEntry constructor to create table entries. You can then
format the table entries and add them to table rows, which you can then add to the table
you are building. If you need to format entries in a table that you have created from a
cell array, you can use the TableEntry or TableRow function entry to gain access to an
entry, which you can then format.
Create a Table Entry
Use a TableEntry constructor to create a table entry. You can optionally use the
constructor to specify these kinds of entry content:
• Char array
• Any of these kinds of DOM objects:
• Paragraph
• Text