SetCustomType

function SetCustomType(
  sType: none | bullet | decimal | lowerRoman | upperRoman | lowerLetter | upperLetter | decimalZero = null,
  sTextFormatString: string = null,
  sAlign: left | right | center = null,
): void

Description

Sets your own customized numbering type.

Parameters

sTypenone | bullet | decimal | lowerRoman | upperRoman | lowerLetter | upperLetter | decimalZerodefault: null

The custom numbering type used for the current numbering definition.

sTextFormatStringstringdefault: null

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.

sAlignleft | right | centerdefault: null

Type of justification applied to the text run in the current numbering level.

Returns

void

Try It

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);
}

Get Help

  • If you have any questions about ONLYOFFICE Docs, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).