[]
Represents a color scale conditional formatting rule.
A color scale rule applies a gradient of colors to cells to indicate relative differences in their values. Use this interface to access the range the rule applies to, configure its threshold criteria, and control its evaluation priority among other conditional formatting rules.
public interface IColorScale
Public Interface IColorScale
IRange range = worksheet.Range["A1:A5"];
range.Value = new object[,] {{10}, {30}, {50}, {70}, {90}};
IColorScale colorScale = range.FormatConditions.AddColorScale(ColorScaleType.TwoColorScale);
colorScale.ColorScaleCriteria[0].FormatColor.Color = Color.Red;
colorScale.AppliesTo = worksheet.Range["B1:B5"];
| Name | Description |
|---|---|
| AppliesTo | Gets or sets the IRange object that specifies the cell range to which the formatting rule is applied. Use the AppliesTo property to change the range associated with this color scale conditional formatting rule. |
| ColorScaleCriteria | Gets the color scale criteria collection. |
| Priority | Gets or sets the priority value of the conditional formatting rule. The priority determines the order of evaluation when multiple conditional formatting rules exist in a worksheet. A lower priority value indicates that the rule is evaluated earlier. Priority values are unique within a worksheet. When the priority of a rule is changed by using Priority, the priority values of other rules on the worksheet may be shifted accordingly. |
| StopIfTrue | Returns a Boolean value that determines if additional formatting rules on the cell should be evaluated if the current rule evaluates to true.
If this property returns |
| Type | Gets the type of this conditional format. |
| Name | Description |
|---|---|
| Delete() | Deletes this conditional format. Use this method to remove the current color scale conditional formatting rule from its worksheet. |
| 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. |
| SetFirstPriority() | Sets the priority value for this conditional formatting rule to "1" so that it will be evaluated before all other rules on the worksheet. |
| SetLastPriority() | Sets the evaluation order for this conditional formatting rule so it is evaluated after all other rules on the worksheet. |
| ToJson() | Generates a JSON string from the conditional format. The returned string represents the current color scale conditional formatting rule and can be used with FromJson(string) to recreate the rule. |