User`s guide
13 Create a Report Program
13-54
• Creating an ordered list from a cell array allows you to include items of different
types in the list.
• Creating a list from scratch is useful for including multiple objects in a list item.
Create an Ordered List from an Array
You can create an unordered list from a numeric array or cell array by including the
array in an mlreportgen.dom.OrderedList object constructor. In the cell array, you
can include strings, numbers, and some DOM objects, such as a Text object. For a list of
DOM objects you can include, see mlreportgen.dom.ListItem.
import mlreportgen.dom.*;
d = Document('orderedListReport','html');
t = Text('step 1');
ol = OrderedList({t,'step 2','step 3'});
append(d,ol);
close(d);
rptview('orderedListReport','html');
Create an Ordered List from Scratch
You can create an unordered list from scratch by creating mlreportgen.dom.ListItem
objects and appending them to an OrderedList object.
import mlreportgen.dom.*;
d = Document('orderedListReport','html');
li1 = ListItem('Create a rank 3 magic square:');
p = append(li1,Paragraph('>> magic(3)'));
p.FontFamilyName = 'Courier New';
li2 = ListItem('step 2');
li3 = ListItem('step 3');
ol = OrderedList();
append(ol,li1);
append(ol,li2);
append(ol,li3);
append(d,ol);
close(d);
rptview('orderedListReport','html');