SetOutlineLvl
Sets the outline level for the specified properties.
Syntax
expression.SetOutlineLvl(lvl);
expression - A variable that represents a ApiParaPr class.
Parameters
| Name | Required/Optional | Data type | Default | Description |
|---|---|---|---|---|
| lvl | Optional | Number | null | undefined | The 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 a paragraph to control its position in the document structure in a document.
// How do I set the outline level of a paragraph in a document?
// Change a paragraph's heading depth so it appears correctly in the navigation panel.
const doc = Api.GetDocument();
const paragraph = doc.GetElement(0);
const paraPr = paragraph.GetParaPr();
const levelBefore = paraPr.GetOutlineLvl();
paraPr.SetOutlineLvl(8);
const levelAfter = paraPr.GetOutlineLvl();
let text = 'Outline level (index) for this paragraph is currently set to ' + levelAfter;
text += ',\nbut originally was set to ' + levelBefore;
paragraph.AddText(text);