ToJSON

ToJSON(bWriteNumberings, bWriteStyles) → { JSON }

Converts the ApiBlockLvlSdt object into the JSON object.

Parameters:

Name Type Description
bWriteNumberings boolean

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

bWriteStyles boolean

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

Returns:

Type
JSON

Example

Copy code
builder.CreateFile("docx");
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);
builder.SaveFile("docx", "ToJSON.docx");
builder.CloseFile();

Resulting document