Main Content

mlreportgen.dom.OutlineLevel Class

Namespace: mlreportgen.dom

Level of paragraph in outline

Description

Specifies the level of a paragraph in an automatically generated outline. This class is intended for Microsoft® Word reports, because HTML does not support displaying paragraphs in a table of contents.

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

Creation

Description

outlineLevelObj = OutlineLevel sets the outline level of this paragraph to 1. This causes the content of the paragraph to appear at the top level in an automatically generated outline (for example, a table of contents).

example

outlineLevelObj = OutlineLevel(level) sets the paragraph to the specified outline level.

Input Arguments

expand all

Outline level for a paragraph, specified as a positive integer, from 1 to 9.

Data Types: int16

Properties

expand all

Object identifier for mlreportgen.dom.OutlineLevel 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

Tag for mlreportgen.dom.OutlineLevel 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

Outline level for a paragraph, specified as a positive integer, from 1 to 9.

Data Types: int16

Examples

collapse all

Add an automatically generated table of contents and set the outline level of the “Glossary” paragraph so that the paragraph appears at the top level of the table of contents. This example uses the default DOM Word template.

Create a document and document part for the table of contents. The document part uses the ReportTOC building block from the default DOM Word template.

import mlreportgen.dom.*
d = Document('tocDoc','docx');
open(d);

dp = DocumentPart(d,'ReportTOC');
append(d,dp);

Set the OutlineLevel property internally, so that there are four levels in the table of contents.

for i = 1:4
    % set internally the OutlineLevel property
    append(d,Heading(i,'My Chapter'));
    append(d,Paragraph('chapter content....'));
end

Use OutlineLevel to set the level of the Glossary paragraph to 1, so that the paragraph appears at the top level of the table of contents. Display the report.

para = append(d,Paragraph('Glossary'));
para.Style = {OutlineLevel(1)};

close(d);
rptview(d.OutputPath,d.Type);

Version History

Introduced in R2014b