mlreportgen.dom.OutlineLevel class

Package: mlreportgen.dom
Superclasses:

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.

Construction

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

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

Output Arguments

expand all

Level of paragraph in outline, represented by an mlreportgen.dom.OutlineLevel object.

Properties

expand all

ID for this document element, specified as a character vector or string scalar. The DOM generates a session-unique ID when it creates the document element. You can specify your own ID.

Tag for this 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.

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