ToJSON

function ToJSON(bWriteNumberings: boolean = null, bWriteStyles: boolean = null): JSON

Description

Converts the ApiBlockLvlSdt object into the JSON object.

Parameters

bWriteNumberingsbooleandefault: null

Specifies if the used numberings will be written to the JSON object or not.

bWriteStylesbooleandefault: null

Specifies if the used styles will be written to the JSON object or not.

Returns

JSON

Try It

var oDocument = Api.GetDocument();
var oBlockLvlSdt = Api.CreateBlockLvlSdt();
oBlockLvlSdt.SetAlias("№1");
var json = oBlockLvlSdt.ToJSON(false, true);
var oBlockLvlSdtFromJSON = Api.FromJSON(json);
oBlockLvlSdtFromJSON.GetContent().GetElement(0).AddText("This is a block text content control.");
oDocument.AddElement(0, oBlockLvlSdtFromJSON);

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).