Get Started
Usage API
More information

ToJSON

ToJSON() → { JSON }

Converts the ApiParagraph 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 = Api.CreateParagraph();
oParagraph.AddText("This is a new paragraph");
let json = oParagraph.ToJSON(false, true);
var oParagraphFromJSON = Api.FromJSON(json);
oParagraphFromJSON.SetBold(true);
oDocument.AddElement(0, oParagraphFromJSON);
builder.SaveFile("docx", "ToJSON.docx");
builder.CloseFile();

Resulting document