Main Content

mlreportgen.dom.TemplateOrderedListStyle Class

Namespace: mlreportgen.dom

Style ordered lists within template

Since R2024a

Description

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

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

Class Attributes

HandleCompatible
true

For information on class attributes, see Class Attributes.

Creation

Description

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

styleObj = mlreportgen.dom.TemplateOrderedListStyle(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 ordered list's StyleName property to the name of this style to format the list as defined by the style.

example

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 the mlreportgen.dom.TemplateOrderedListStyle 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 the mlreportgen.dom.TemplateOrderedListStyle 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 ordered list style in a template and then apply that style in your document.

Create the Style in the Template

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

import mlreportgen.dom.*;

Create and open a template.

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

Create a list style.

listStyle = TemplateOrderedListStyle("myOrderedListStyle");

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 in a Document

Create a document using the generated template.

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

Create a list object.

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

Set the style name.

list.StyleName = "myOrderedListStyle";

Add the list to the document.

append(d,list);

Close and view the document.

close(d);
rptview(d);

Version History

Introduced in R2024a