[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.IColorScale.FromJson

FromJson Method

FromJson(string)

Generates the conditional format from the JSON string.

Uses the specified JSON content to update this color scale rule. The JSON is typically generated by ToJson() from another IColorScale instance.

Declaration
void FromJson(string json)
Sub FromJson(json As String)
Parameters
Type Name Description
string json

The JSON string that defines the color scale conditional format.

Examples
IRange range = worksheet.Range["A1:A5"];
range.Value = new object[,] {{10}, {30}, {50}, {70}, {90}};
string json = "{\"ranges\":[{\"row\":0,\"col\":1,\"rowCount\":5,\"colCount\":1}],\"priority\":1,\"ruleType\":10,\"minType\":1,\"minValue\":null,\"minColor\":\"rgb(255,0,0)\",\"maxType\":2,\"maxValue\":null,\"maxColor\":\"rgb(255,239,156)\"}";
IColorScale colorScale = worksheet.Range["B1:B5"].FormatConditions.AddColorScale(ColorScaleType.TwoColorScale);
colorScale.FromJson(json);
Exceptions
Type Condition
InvalidOperationException

if the JSON string does not describe a color scale conditional format.