User`s guide

Create and Format Tables
13-61
close(doc);
rptview(doc.OutputPath);
Format a Table
You can format a 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 Table Programmatically
You can use format objects to format tables or use Table format properties to specify
commonly used table formats. This example uses:
Border, ColSep, and RowSep format objects to specify a red table border and the
green column and row separators
The Width format property to specify the table width
import mlreportgen.dom.*;
doc = Document('test','html');
table = Table(magic(5));
table.Style = {Border('inset','red','3px'), ...
ColSep('single','green','1px'), ...
RowSep('single','green','1px')};
table.Width = '50%';
append(doc, table);
close(doc);
rptview(doc.OutputPath);
Use these format objects and format properties to format a table.
Formatting Format Object Format Property
Width of table Width Width
Color of table background BackgroundColor BackgroundColor
Create border around table Border Border