SetNumPr
function SetNumPr(oNumPr: any = null, nLvl: any = 0): void
Description
Specifies that the current paragraph references a numbering definition instance in the current document.
Parameters
- oNumPr
any
null Specifies a numbering definition.
- nLvl
any
0 Specifies a numbering level reference. If the current instance of the ApiParaPr class is direct formatting of a paragraph, then this parameter MUST BE specified. Otherwise, if the current instance of the ApiParaPr class is the part of ApiStyle properties, this parameter will be ignored.
Returns
void
Try It
var oDocument = Api.GetDocument();
var oMyStyle = oDocument.CreateStyle("My document style");
var oParaPr = oMyStyle.GetParaPr();
var oNumbering = oDocument.CreateNumbering("bullet");
oParaPr.SetNumPr(oNumbering);
for (let nLvl = 0; nLvl < 8; ++nLvl) {
var oNumLvl = oNumbering.GetLevel(nLvl);
var oParagraph = Api.CreateParagraph();
oParagraph.AddText("Default bullet lvl " + (nLvl + 1));
oParagraph.SetNumbering(oNumLvl);
oParagraph.SetContextualSpacing(true);
oDocument.Push(oParagraph);
}
oParagraph = Api.CreateParagraph();
oParagraph.SetStyle(oMyStyle);
oParagraph.AddText("This is a paragraph styled as a bulleted list.");
oDocument.Push(oParagraph);