User`s guide
13 Create a Report Program
13-66
Create a Formal Table
To create a formal table, use the same basic approaches as with an informal table, except
that you must use an mlreportgen.domlFormalTable constructor to construct a
formal table. The constructor optionally accepts a two-dimensional numeric array or a
cell array of MATLAB data for the body, header, and footer sections.
If you choose to build a formal table completely or partially from scratch, you can use the
FormalTable object functions appendHeaderRow and appendBodyRow to append rows
to the table header and footer sections. The FormalTable.append function appends a
row to the body section. Alternatively, you can access a section using the Header, Body,
or Footer properties of the FormalTable object.
import mlreportgen.dom.*
d = Document('test');
t = FormalTable({'a','b';'c','d'});
r = TableRow();
append(r,TableEntry('Column 1'));
append(r,TableEntry('Column 2'));
append(t.Header,r);
append(d,t);
close(d);
rptview(d.OutputPath);
Format a Formal Table
You can format a formal table programmatically, using DOM format objects or format
properties. You can also use Word and HTML template styles. For information about
these formatting techniques and format inheritance, see “Report Formatting Approaches”
on page 13-20.
Format a Formal Table Programmatically
You can format a formal table programmatically the same way you format an informal
table. The format objects and properties that apply to an informal table also apply to
formal tables. In addition, you can format the header, body, and footer sections of an
informal table programmatically. If you specify a format for the table and one of its
sections, the value you specify for the section overrides the value you specify for the table