Get Started
Documentation

SetNumbering

SetNumbering(oNumberingLevel)

Specify that the current paragraph references a numbering definition instance in the current document.

Parameters:

Name Type Description
oNumberingLevel ApiNumberingLevel

The numbering level which will be used for assigning the numbers to the paragraph.

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph;
var oNumbering = oDocument.CreateNumbering("bullet");
var oNumLvl;
for (var nLvl = 0; nLvl < 8; ++nLvl) {
  oNumLvl = oNumbering.GetLevel(nLvl);
  oParagraph = Api.CreateParagraph();
  oParagraph.AddText("Default bullet lvl " + (nLvl + 1));
  oParagraph.SetNumbering(oNumLvl);
  oParagraph.SetContextualSpacing(true);
  oDocument.Push(oParagraph);
}
builder.SaveFile("docx", "SetNumbering.docx");
builder.CloseFile();

Resulting document