mlreportgen.dom.ListItem class

Package: mlreportgen.dom

Create item for ordered or unordered list


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


listItemObj = ListItem() creates an empty list item.


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.

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.

Output Arguments

expand all

List item, represented by an mlreportgen.dom.ListItem object.


expand all

This read-only property lists child elements of this object.

The output format must support the custom attributes of this document element.

ID for this document element, specified as a character vector. 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.

This read-only property lists the parent of this document element.

This property is ignored.

Tag for document element, specified as a character vector.

A session-unique ID is generated as part of document element creation. The generated tag has the form CLASS:ID, where CLASS is the class of the element and ID is the value of the Id property of the object. You can specify a tag to replace the generated tag.

For example, to make it easier to identify where an issue occurred during document generation, you can specify your own tag value.





Use ListItem.append in a similar way as you use Paragraph.append, except you can append different content to a list item than to a paragraph.

Append a character vector or any of these kinds of DOM objects to a list item:

  • Text

  • Paragraph

  • Table

  • Image

  • ExternalLink

  • InternalLink

  • CustomElement


Use ListItem.clone the same way you use Paragraph.clone.

Clone a list item.


collapse all

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

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