TRY NEW VERSION

Try now New API BETA

Try out the new view and capabilities of the API documentation

START

ApiNumberingLevel

new ApiNumberingLevel()

Class representing a reference to a specified level of the numbering.

Methods

Name Description
GetClassType

Returns a type of the ApiNumberingLevel class.

GetLevelIndex

Returns the level index.

GetNumbering

Returns the numbering definition.

GetParaPr

Returns the paragraph properties which are applied to any numbered paragraph that references the given numbering definition and numbering level.

GetTextPr

Specifies the text properties which will be applied to the text in the current numbering level itself, not to the text in the subsequent paragraph. To change the text style of the paragraph, a style must be applied to it using the ApiRun#SetStyle method.

SetCustomType

Sets your own customized numbering type.

SetRestart

Specifies a one-based index which determines when a numbering level should restart to its starting value. A numbering level restarts when an instance of the specified numbering level which is higher (earlier than this level) is used in the given document contents. By default this value is true.

SetStart

Specifies the starting value for the numbering used by the parent numbering level within a given numbering level definition. By default this value is 1.

SetSuff

Specifies the content which will be added between the given numbering level text and the text of every numbered paragraph which references that numbering level. By default this value is "tab".

SetTemplateType

Sets one of the existing predefined numbering templates.

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oNumbering = oDocument.CreateNumbering("numbered");
for (let nLvl = 0; nLvl < 8; ++nLvl) {
  var oNumLvl = oNumbering.GetLevel(nLvl);
  var sFormatString = "";
  for (let nTempLvl = 1; nTempLvl <= (nLvl + 1); ++nTempLvl) sFormatString += "%" + nTempLvl + ".";
  oNumLvl.SetCustomType("lowerRoman", sFormatString, "left");
  oNumLvl.SetStart(nLvl + 1);
  oNumLvl.SetSuff("space");
  var oParagraph = Api.CreateParagraph();
  oParagraph.AddText("Custom numbered lvl " + (nLvl + 1));
  oParagraph.SetNumbering(oNumLvl);
  oParagraph.SetContextualSpacing(true);
  oDocument.Push(oParagraph);
}
builder.SaveFile("docx", "ApiNumberingLevel.docx");
builder.CloseFile();

Resulting document