ToJSON

function ToJSON(): JSON

Description

Converts the ApiNumbering object into the JSON object.

Returns

JSON

Try It

var oDocument = Api.GetDocument();
var oNumbering = oDocument.CreateNumbering("bullet");
var json = oNumbering.ToJSON();
var oNumberingFromJSON = Api.FromJSON(json);
for (var nLvl = 0; nLvl < 2; ++nLvl) {
   var oNumLvl = oNumberingFromJSON.GetLevel(nLvl);
   var oParagraph = Api.CreateParagraph();
   oParagraph.AddText("This is an example of the bulleted paragraph № " + (nLvl + 1));
   oParagraph.SetNumbering(oNumLvl);
   oDocument.Push(oParagraph);
}
var sType = oNumberingFromJSON.GetClassType();
oParagraph = Api.CreateParagraph();
oParagraph.AddText("Class type = " + sType);
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).