User`s guide

13 Create a Report Program
13-56
d = Document('orderedListReport','html');
ol = OrderedList({'Start MATLAB', ...
'Create a rank 3 or 4 magic square:'});
optionList = UnorderedList;
li = ListItem('>> magic(3)');
table = append(li,Table(magic(3)));
table.Width = '1in';
append(optionList, li);
li = ListItem('>> magic(4)');
table = append(li,Table(magic(4)));
table.Width = '1in';
append(optionList,li);
append(ol, optionList);
append(ol, ListItem('Close MATLAB'));,
append(d,ol);
close(d);
rptview('orderedListReport','html');
Format Lists
You can use list styles defined in a report style sheet to specify the indentation of each
level of a list and the type of bullet or the number format used to render list items. To use
a template-defined list style to format a list, set the StyleName property of the list to the
name of the style. For example:
import mlreportgen.dom.*;
d = Document('myListReport','html','MyTemplate');
list = append(d,{'first item',...
OrderedList({'step 1','step 2'}),'second item'});
list.StyleName = 'MyListStyle';
close(d);
rptview('myListReport','html');
Note: A list style determines how list items are rendered regardless of the list type.
If you do not specify a list style, the DOM API uses a default list style that renders
the list according to type. For example, the default list style for unordered lists uses
bullets to render list items. If you specify a list style for an UnorderedList object that
numbers top-level items, the top-level items are numbered, even though the object type is
unordered (bulleted).