Skip to main content

SetOutlineLvl

Sets the outline level for the specified properties.

Inherited from ApiParaPr.SetOutlineLvl.

Syntax​

expression.SetOutlineLvl(lvl);

expression - A variable that represents an ApiParagraph class.

Parameters​

NameRequired/OptionalData typeDefaultDescription
lvlOptionalNumber | null | undefinedThe outline level. Possible values: 1-9. The 1The desired functionality is as follows: When inserting document A into document B using the merge document API during editing, the source of document A should be visible within document B. By clicking or hovering over the inserted content of document A in document B, information about the insertion of document A should be displayed in a pop-up/floating window, preserving the boundaries of document A. Document A should be able to be inserted between any two characters in document B. To set no outline level, use this method without a parameter.

Returns​

boolean

Example​

Assign an outline level to paragraphs to structure the document hierarchy in a document.

// How do I mark a paragraph as a heading level for the document outline in a document?

// Control which paragraphs appear as headings in the navigation pane of a document.

const doc = Api.GetDocument();
const firstParagraph = doc.GetElement(0);
firstParagraph.AddText('Outline level of this paragraph is ' + firstParagraph.GetOutlineLvl() + '.');

for (let levelIndex = 0; levelIndex < 9; levelIndex++) {
const paragraph = Api.CreateParagraph();
paragraph.SetOutlineLvl(levelIndex);

const level = paragraph.GetOutlineLvl() + 1;
paragraph.AddText('This is a paragraph with outline level ' + level + '.');
doc.Push(paragraph);
}