Top10 class

Top10 class

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.

The Top10 type exposes the following members:

Constructors

ConstructorDescription
initConstructs a new instance of Top10

Properties

PropertyDescription
is_percentGet or set whether a “top/bottom n” rule is a “top/bottom n percent” rule.
Default value is false.
is_bottomGet or set whether a “top/bottom n” rule is a “bottom n” rule.
Default value is false.
rankGet 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.

Example

from aspose.cells import CellArea, FormatConditionType, OperatorType, Workbook
from aspose.pydrawing import Color

# Instantiating a Workbook object
workbook = Workbook()
sheet = workbook.worksheets[0]
# Adds an empty conditional formatting
index = sheet.conditional_formattings.add()
fcs = sheet.conditional_formattings[index]
# Sets the conditional format range.
ca = CellArea.create_cell_area(0, 0, 10, 10)
fcs.add_area(ca)
# Adds condition.
conditionIndex = fcs.add_condition(FormatConditionType.TOP10, OperatorType.NONE, None, None)
# Sets the background color.
fc = fcs[conditionIndex]
fc.style.background_color = Color.red
top10 = fc.top10
# Set the Top N
top10.rank = 5
# Saving the Excel file
workbook.save("output.xls")

See Also