ToJSON

ToJSON(bWriteNumberings, bWriteStyles) → { JSON }

Converts the ApiParagraph 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 oParagraph = Api.CreateParagraph();
oParagraph.AddText("This is a new paragraph");
var 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