Main Content

mlreportgen.dom.TemplateUnorderedListStyle Class

Namespace: mlreportgen.dom

Style unordered lists within template

Since R2024a

Description

Use this class to create a Document Object Model (DOM) representation of an unordered list style.

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

Class Attributes

HandleCompatible
true

For information on class attributes, see Class Attributes.

Creation

Description

styleObj = mlreportgen.dom.TemplateUnorderedListStyle creates a list style object with default property values. You must set the object's Name property to use this style.

example

styleObj = mlreportgen.dom.TemplateUnorderedListStyle(name) creates a list style object and sets the Name property to name. Add an instance of this object to the stylesheet specified by a template's Stylesheet property to use this style to format lists based on the template. Set an unordered list's StyleName property to the name of this style to format the list as defined by the style.

Properties

expand all

Name of the style, specified as a string scalar or character vector.

Note

The name must include only letters, numbers, hyphens (-), and underscores (_).

Attributes:

NonCopyable
true

Data Types: char | string

Style sheet formats, specified as an array of DOM formatting objects. These formats define how this style affects report content.

Attributes:

NonCopyable
true

Formats for specific list levels.

Note

Microsoft® Word supports only nine levels of list formatting. To format more list levels in HTML and PDF templates, create custom mlreportgen.dom.TemplateHTMLStyle or mlreportgen.dom.TemplatePDFStyle objects that use CSS selectors for the desired levels.

Attributes:

SetAccess
private
NonCopyable
true

Tag for mlreportgen.dom.TemplateUnorderedListStyle object, 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. Specify your own tag value to help you identify where to look when an issue occurs during document generation.

Attributes:

NonCopyable
true

Data Types: char | string

Object identifier for mlreportgen.dom.TemplateUnorderedListStyle object, specified as a character vector or string scalar. The DOM API generates a session-unique identifier when it creates the document element object. You can specify your own value for Id.

Attributes:

NonCopyable
true

Data Types: char | string

Examples

collapse all

Create an unordered list style in a template and then apply that style in your document.

Create the Style

Import the DOM API namespace so that you do not have to use long, fully qualified names.

import mlreportgen.dom.*;

Create and open a template.

t = Template("myTemplate","pdf");
open(t);

Create a list style.

listStyle = TemplateUnorderedListStyle("myUnorderedListStyle");

Define formats for the list style.

listStyle.Formats = [Bold, Color("blue")];

Add style to the stylesheet.

addStyle(t.Stylesheet,listStyle);

Close the template.

close(t);

Use the Style from the Template

Create a document using the generated template.

d = Document("myDoc","pdf","myTemplate");
open(d);

Create a list object.

list = UnorderedList(["item 1", "item 2"]);

Set the style name.

list.StyleName = "myUnorderedListStyle";

Add the list to the document.

append(d,list);

Close and view the document.

close(d);
rptview(d);

Version History

Introduced in R2024a