Get Started
Usage API
More information

ToJSON

ToJSON() → { JSON }

Converts the ApiInlineLvlSdt object into the JSON object.

Parameters:

This method doesn't have any parameters.

Returns:

Type
JSON

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
var oInlineLvlSdt = Api.CreateInlineLvlSdt();
oInlineLvlSdt.SetAlias("№1");
let json = oInlineLvlSdt.ToJSON(true);
var oInlineLvlSdtFromJSON = Api.FromJSON(json);
oParagraph.AddInlineLvlSdt(oInlineLvlSdtFromJSON);
var oRun = Api.CreateRun();
oRun.AddText("This is an inline text content control.");
oInlineLvlSdtFromJSON.AddElement(oRun, 0);
builder.SaveFile("docx", "ToJSON.docx");
builder.CloseFile();

Resulting document