Get Started
Documentation

SetCustomType

SetCustomType(sType, sTextFormatString, sAlign)

Set your own customized numbering type.

Parameters:

Name Type Description
sType "none" | "bullet" | "decimal" | "lowerRoman" | "upperRoman" | "lowerLetter" | "upperLetter" | "decimalZero" The custom numbering type used for the current numbering definition.
sTextFormatString string Any text in this parameter will be taken as literal text to be repeated in each instance of this numbering level, except for any use of the percent symbol (%) followed by a number, which will be used to indicate the one-based index of the number to be used at this level. Any number of a level higher than this level will be ignored.
sAlign "left" | "right" | "center" Type of justification applied to the text run in the current numbering level.

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", "SetCustomType.docx");
builder.CloseFile();

Resulting document