Get Started
Usage API
More information

ToJSON

ToJSON() → { JSON }

Converts the ApiTable 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 oTable = Api.CreateTable(3, 3);
let json = oTable.ToJSON(false, true);
var oTableFromJSON = Api.FromJSON(json);
oTableFromJSON.SetTableBorderTop("single", 32, 0, 0, 0, 255);
oTableFromJSON.SetTableBorderBottom("single", 32, 0, 0, 0, 255);
oTableFromJSON.SetTableBorderLeft("single", 32, 0, 0, 0, 255);
oTableFromJSON.SetTableBorderRight("single", 32, 0, 0, 0, 255);
oTableFromJSON.SetTableBorderInsideV("single", 32, 0, 255, 0, 0);
oTableFromJSON.SetTableBorderInsideH("single", 32, 0, 255, 0, 0);
oTableFromJSON.SetWidth("percent", 100);
oDocument.Push(oTableFromJSON);
builder.SaveFile("docx", "ToJSON.docx");
builder.CloseFile();

Resulting document