[]
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.
void FromJson(string json)
Sub FromJson(json As String)
| Type | Name | Description |
|---|---|---|
| string | json | The JSON string that defines the color scale conditional format. |
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);
| Type | Condition |
|---|---|
| InvalidOperationException | if the JSON string does not describe a color scale conditional format. |