User`s guide
13 Create a Report Program
13-52
Create and Format Lists
In this section...
“Create an Unordered List” on page 13-52
“Create an Ordered List” on page 13-53
“Create a Multilevel List” on page 13-55
“Format Lists” on page 13-56
You can add two kinds of lists to a report:
• Unordered (bulleted)
• Ordered (numbered)
• Multilevel (lists that contain ordered or unordered lists in any combination)
Create an Unordered List
You can create an unordered list from a numeric or cell array or from scratch.
• Creating a 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 Unordered List from an Array
You can create an unordered list by appending a one-dimensional numeric or cell
array to a document (or document part). The append function converts the array to an
mlreportgen.dom.UnorderedList object, appends the object to the document, and
returns the object, which you can then format. 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('myListReport','html');
t = Text('third item');
append(d,{'first item',6,t,'fourth item'});