Main Content

mlreportgen.dom.ListItem Class

Namespace: 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.

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.

example

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 or string scalar.

Properties

expand all

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

Attributes:

GetAccess
public
SetAccess
public
NonCopyable
true

Format specification for this document element object, specified as an array of DOM format objects. The formats specified by this property override corresponding formats specified by the StyleName property of this element. Formats that do not apply to this document element object are ignored.

Attributes:

GetAccess
public
SetAccess
public
NonCopyable
true

The class ignores this property.

Attributes:

GetAccess
public
SetAccess
public
NonCopyable
true

Parent of this object, specified as a document element object. A document element must have only one parent.

Attributes:

GetAccess
public
SetAccess
private
NonCopyable
true

Children of this object, specified as an array of document element objects. This property contains the document element objects appended using the append method.

Attributes:

GetAccess
public
SetAccess
private
NonCopyable
true

Tag, specified as a character vector or string scalar. The DOM API 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. Use this value to help identify where an issue occurs during document generation.

Attributes:

GetAccess
public
SetAccess
public
NonCopyable
true

Data Types: char | string

Object identifier, specified as a character vector or string scalar. The DOM API generates a session-unique identifier when it creates the document element object.

Attributes:

GetAccess
public
SetAccess
public
NonCopyable
true

Data Types: char | string

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