Main Content

mlreportgen.dom.ListItem class

Package: mlreportgen.dom

Create item for ordered or unordered list

Description

Specifies an item in an ordered (numbered) or unordered (bulleted) list.

The mlreportgen.dom.ListItem class is a handle class.

Creation

Description

listItemObj = ListItem() creates an empty list item.

example

listItemObj = ListItem(text) creates a list item using the specified text. The constructor creates a text object and appends the text object to the list item. In Microsoft® Word and PDF output, text in a list item is wrapped in a paragraph because Word and PDF do not permit unwrapped text in list items. In HTML output, the text is not wrapped in a paragraph.

listItemObj = ListItem(text,styleName) creates a list item using the specified text and applies the specified style.

listItemObj = ListItem(domObj) creates a list item and appends the specified document element object to the list item.

listItemObj = ListItem(domObj,styleName) creates a list item using the specified document element object and style name.

Input Arguments

expand all

The constructor creates an mlreportgen.dom.Text object for the specified text.

You can specify a Paragraph object or elements that you can append to a paragraph, including the following kinds of DOM objects:

  • mlreportgen.dom.Text

  • mlreportgen.dom.Paragraph

  • mlreportgen.dom.Image

  • mlreportgen.dom.Table

  • mlreportgen.dom.FormalTable

  • mlreportgen.dom.ExternalLink

  • mlreportgen.dom.InternalLink

  • mlreportgen.dom.CustomElement

Name of style to use for the list item, specified as a character vector.

Properties

expand all

Children of this document element, specified as an array of DOM objects. This property is read-only.

Custom attributes of this document element, specified as an array of mlreportgen.dom.CustomAttribute objects. The custom attributes must be supported by the output format.

ID for this document element, specified as a character vector or string scalar. The DOM generates a session-unique ID when it creates the document element. You can specify your own ID.

Format objects that specify the format of a document element.

Parent of this document element, specified as a DOM object. This property is read-only.

This property is ignored.

Tag for this document element, specified as a character vector or string scalar.

The DOM generates a session-unique tag as part of the creation of this object. The generated tag has the form CLASS:ID, where CLASS is the object class and ID is the value of the Id property of the object. Specifying your own tag value can help you to identify where an issue occurred during document generation.

Methods

expand all

Examples

collapse all

import mlreportgen.dom.*;
doctype = 'html';
d = Document('test',doctype);
p = Paragraph('Perform the following steps.');
append(d,p);

step1 = ListItem('Do this step first.');
textForItem = Text('Next, do this.');
step2 = ListItem(textForItem);
procedure = OrderedList();
append(procedure,step1);
append(procedure,step2);
append(d,procedure);

close(d);
rptview('test',doctype);

Tips

  • Depending on how you create a multilevel list, a sublist can be a child of the parent list or a child of the preceding list item in the parent list. If the sublist is child of a list item in the parent list, the sublist inherits the formatting from the list item. If the sublist is a child of the parent list, the sublist does not inherit the formatting from the previous list item. See Format List Items in Multilevel Lists.

Version History

Introduced in R2014b