ToJSON
function ToJSON(bWriteNumberings: boolean = null, bWriteStyles: boolean = null): JSON
Description
Converts the ApiDrawing object into the JSON object.
Parameters
- bWriteNumberings
boolean
null Specifies if the used numberings will be written to the JSON object or not.
- bWriteStyles
boolean
null Specifies if the used styles will be written to the JSON object or not.
Returns
JSON
Try It
var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
var oGs1 = Api.CreateGradientStop(Api.CreateRGBColor(255, 224, 204), 0);
var oGs2 = Api.CreateGradientStop(Api.CreateRGBColor(255, 164, 101), 100000);
var oFill = Api.CreateLinearGradientFill([oGs1, oGs2], 5400000);
var oStroke = Api.CreateStroke(0, Api.CreateNoFill());
var oDrawing = Api.CreateShape("rect", 5930900, 395605, oFill, oStroke);
var json = oDrawing.ToJSON(false, true);
var oDrawingFromJSON = Api.FromJSON(json);
oParagraph.AddDrawing(oDrawingFromJSON);