mlreportgen.dom.ListItem class

Package: mlreportgen.dom
Superclasses:

Create item for ordered or unordered list

Description

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

Construction

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.

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.

Properties

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

The DOM generates a session-unique tag when it creates the document element. Structure the tag as class:id, where class is the class of the element and id is the value of the Id property. You can specify a tag to replace the generated tag. Specifying your own tag can make it easier to identify where an issue occurred during document generation.

Methods

Method

Purpose

append

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

clone

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

Clone a list item.

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);