[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.IDataBar.FromJson

FromJson Method

FromJson(string)

Loads the data bar conditional format from a JSON string.

This method replaces the current data bar rule with the rule defined in the specified JSON string. The JSON content is typically generated by ToJson().

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

The JSON string that defines a data bar conditional format.

Examples
worksheet.Range["A1:A3"].Value = new object[,] {{10}, {30}, {20}};
IDataBar dataBar = worksheet.Range["A1:A3"].FormatConditions.AddDatabar();
dataBar.BarFillType = DataBarFillType.Solid;
dataBar.BarColor.Color = Color.Green;
dataBar.ShowValue = false;
string json = dataBar.ToJson();
IDataBar copiedDataBar = worksheet.Range["B1:B3"].FormatConditions.AddDatabar();
copiedDataBar.FromJson(json);
Exceptions
Type Condition
InvalidOperationException

if the specified JSON string does not describe a data bar conditional format.