Get Started
Documentation

ApiNumberingLevel

new ApiNumberingLevel()

Class representing a reference to a specified numbering level.

Methods

Name Description
GetClassType Get the type of this class.
GetLevelIndex Get the level index.
GetNumbering Get the numbering definition.
GetParaPr The paragraph properties which are applied to any numbered paragraph that references the given numbering definition and numbering level.
GetTextPr Specify the text properties which will be applied to the text in the current numbering level itself, not to the text in the subsequent paragraph.
SetCustomType Set your own customized numbering type.
SetRestart Specify 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 will be higher (earlier than the this level) is used in the given document contents. By default this value is true.
SetStart Specify 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 Specify the content which will be added between a given numbering level text and the text of every numbered paragraph which references that numbering level. By default this value is "tab".
SetTemplateType Set one of the existing predefined numbering templates.

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph;
oNumbering = oDocument.CreateNumbering("numbered");
for (var nLvl = 0; nLvl < 8; ++nLvl)
{
	oNumLvl = oNumbering.GetLevel(nLvl);

	var sFormatString = "";
	for (var nTempLvl = 0; nTempLvl <= nLvl; ++nTempLvl)
		sFormatString += "%" + nTempLvl + ".";

	oNumLvl.SetCustomType("lowerRoman", sFormatString, "left");
	oNumLvl.SetStart(nLvl + 1);
	oNumLvl.SetSuff("space");

	oParagraph = Api.CreateParagraph();
	oParagraph.AddText("Custom numbered lvl " + (nLvl + 1));
	oParagraph.SetNumbering(oNumLvl);
	oParagraph.SetContextualSpacing(true);
	oDocument.Push(oParagraph);

	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