ToJSON
Converts the ApiStyle 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. |
Returns:
- Type
-
JSON
Example
Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oTableStyle = oDocument.GetStyle("Bordered");
var json = oTableStyle.ToJSON(false);
var oStyleFromJSON = Api.FromJSON(json);
oStyleFromJSON.SetName("My Custom Style");
var oTable = Api.CreateTable(2, 2);
oTable.SetWidth("percent", 100);
oTable.SetStyle(oStyleFromJSON);
oDocument.Push(oTable);
builder.SaveFile("docx", "ToJSON.docx");
builder.CloseFile();
Resulting document