[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.ITop10

ITop10 Interface

Represents a conditional formatting rule that highlights the top or bottom N values.

Use this interface to configure a top or bottom N ranking rule for a range. An ITop10 object is typically created by calling AddTop10() on a range's conditional formatting collection, and then setting the rank, whether it is calculated as a percentage, and whether values are ranked from the top or bottom.

Namespace: GrapeCity.Documents.Excel
Assembly: DS.Documents.Excel.dll
Syntax
public interface ITop10
Public Interface ITop10
Examples
worksheet.Range["A1:A5"].Value = new object[,] {{10}, {30}, {20}, {50}, {40}};
ITop10 top10 = worksheet.Range["A1:A5"].FormatConditions.AddTop10();
top10.TopBottom = TopBottom.Top;
top10.Rank = 2;
top10.Interior.Color = Color.Red;

Properties

Name Description
AppliesTo

Gets or sets the IRange object for the cell range to which the formatting rule is applied.

Borders

Gets an instance of IBorders which represents the borders of this conditional format.

Use the returned IBorders object to configure the border formatting that is applied when the top 10 conditional formatting rule is triggered.

Font

Gets an instance of IFont which represents the font of this conditional format.

Use the returned IFont object to configure font settings that are applied when the top 10 conditional formatting rule is triggered.

Interior

Gets an instance of IInterior that represents the background color of this conditional format.

NumberFormat

Gets or sets the number format applied to a cell if the conditional formatting rule evaluates to true.

The returned string uses an Excel-style number format pattern for this top or bottom N conditional formatting rule.

Percent

Gets or sets a Boolean value that indicates whether the rank is calculated as a percentage.

When this property returns true, the value specified by Rank is interpreted as a percentage instead of a fixed count.

Priority

Gets or sets the priority value of the conditional formatting rule.

The priority is a unique positive integer within the worksheet, so changing the priority of one rule can shift the priority values of other rules.

Rank

Gets or sets the rank value for the conditional format rule.

Returns an integer that specifies either the number of ranked items or the percentage value used by the rule, depending on Percent.

StopIfTrue

Gets or sets a Boolean value that indicates whether additional formatting rules on the cell should be evaluated if the current rule evaluates to true.

TopBottom

Gets or sets a TopBottom value that determines whether values are ranked from the top or bottom.

Use this property to inspect whether the conditional formatting rule evaluates the highest values or the lowest values in the applied range.

Type

Gets the type of this conditional format.

Use this property to identify the conditional formatting rule type represented by this ITop10 instance. For a top or bottom N rule, the returned value is Top10.

Methods

Name Description
Delete()

Deletes this conditional format.

Use this method to remove the current top or bottom conditional formatting rule from the worksheet.

FromJson(string)

Generates the conditional format from the JSON string.

Use this method to update an existing top or bottom N conditional format from a JSON definition. The JSON must describe a top or bottom N conditional format for this ITop10 object. The caller's range is used to generate the conditional format, so the range information in the JSON is ignored.

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.

Use this method to serialize the current top or bottom N conditional formatting rule so that it can be stored or later restored with FromJson(string).