User`s guide

Create and Format Tables
13-67
as a whole. Not all formal table formats apply to formal table sections. For example, you
cannot indent a header, body, or footer section independently of the containing table. In
other words, the OuterLeftMargin property does not apply to formal table sections.
Apply Table Styles to a Formal Table and Its Sections
Use the same procedure for defining formal table styles in Word and HTML templates as
you use for defining informal table styles.
You can apply a table style to a formal table and to each of its sections. If you apply
a table style to the table itself and to one of its section (for example, the header), the
section style overrides the table style.
Note: If you apply a table style to one or more sections of a Word formal table, you must
specify the widths of each of the table columns. Otherwise, the columns of the sections
may not line up.
Create and Format Table Rows
If you need to build a table from scratch, you can use the TableRow constructor to create
the rows. Format the rows and then append the rows to a table that you are building.
Create a Table Row
The mlreportgen.dom.TableRow constructor takes no arguments and returns a
TableRow object. You can then create and append TableEntry objects to the object to
complete the row construction. Once you construct the row, you can add the row to the
table, using the append function. This example creates a two-column table with two
rows.
import mlreportgen.dom.*
rpt = Document('test');
table = Table(2);
row = TableRow();
append(row,TableEntry('Col1'));
append(row,TableEntry('Col2'));
append(table,row);