Class Top10

Class Top10

Namespace: Aspose.Cells
Assembly: Aspose.Cells.dll (25.2.0)

Describe the Top10 conditional formatting rule. This conditional formatting rule highlights cells whose values fall in the top N or bottom N bracket, as specified.

public class Top10

Inheritance

objectTop10

Inherited Members

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Examples

csharp
[C#]
//Instantiating a Workbook object
Workbook workbook = new Workbook();
Worksheet sheet = workbook.Worksheets[0];

//Adds an empty conditional formatting
int index = sheet.ConditionalFormattings.Add();
FormatConditionCollection fcs = sheet.ConditionalFormattings[index];

//Sets the conditional format range.
CellArea ca = CellArea.CreateCellArea(0, 0, 10, 10);
fcs.AddArea(ca);

//Adds condition.
int conditionIndex = fcs.AddCondition(FormatConditionType.Top10, OperatorType.None, null, null);   
//Sets the background color.
FormatCondition fc = fcs[conditionIndex];
fc.Style.BackgroundColor = Color.Red;
Top10 top10 = fc.Top10;
//Set the Top N 
top10.Rank = 5;  
//Saving the Excel file
workbook.Save("output.xls");

'Instantiating a Workbook object
Dim workbook As Workbook = New Workbook()
Dim sheet As Worksheet = workbook.Worksheets(0)

' Adds an empty conditional formatting
Dim index As Integer = sheet.ConditionalFormattings.Add()
Dim fcs As FormatConditionCollection = sheet.ConditionalFormattings(index)

'Sets the conditional format range.
Dim ca As CellArea = CellArea.CreateCellArea(0, 0, 10, 10)
fcs.AddArea(ca)

'Adds condition.
Dim conditionIndex As Integer = fcs.AddCondition(FormatConditionType.Top10, OperatorType.None, null, null);   
'Sets the background color.
Dim fc As FormatCondition = fcs(conditionIndex)
fc.Style.BackgroundColor = Color.Red
Dim top10 as Top10  = fc.Top10
'Set the Top N 
top10.Rank = 5
'Saving the Excel file
workbook.Save("output.xls")

Constructors

Top10()

public Top10()

Properties

IsBottom

Get or set whether a “top/bottom n” rule is a “bottom n” rule. Default value is false.

public bool IsBottom { get; set; }

Property Value

bool

IsPercent

Get or set whether a “top/bottom n” rule is a “top/bottom n percent” rule. Default value is false.

public bool IsPercent { get; set; }

Property Value

bool

Rank

Get or set the value of “n” in a “top/bottom n” conditional formatting rule. If IsPercent is true, the value must between 0 and 100. Otherwise it must between 0 and 1000. Default value is 10.

public int Rank { get; set; }

Property Value

int