ToJSON
Converts the ApiColor object into the JSON object.
Syntax
expression.ToJSON();
expression - A variable that represents a ApiColor class.
Parameters
This method doesn't have any parameters.
Returns
string
Example
Convert a shape fill color to JSON in a spreadsheet.
// The color is obtained from the first shape fill on the worksheet.
// Convert the color to a JSON string and display the result.
const worksheet = Api.GetActiveSheet();
const color = Api.RGB(64, 128, 192);
const fill = Api.CreateSolidFill(color);
const stroke = Api.CreateStroke(0, Api.CreateNoFill());
worksheet.AddShape("rect", 120 * 36000, 70 * 36000, fill, stroke, 0, 2 * 36000, 0, 3 * 36000);
worksheet.GetRange("A12").SetValue("Color JSON: " + color.ToJSON());