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.
Example:
//Instantiating a Workbook object
Workbook workbook = new Workbook();
Worksheet sheet = workbook.getWorksheets().get(0);
//Adds an empty conditional formatting
int index = sheet.getConditionalFormattings().add();
FormatConditionCollection fcs = sheet.getConditionalFormattings().get(index);
//Sets the conditional format range.
CellArea ca = CellArea.createCellArea(0, 0, 10, 10);
fcs.addArea(ca);
//Adds condition.
int conditionIndex = fcs.addCondition(FormatConditionType.TOP_10, OperatorType.NONE, null, null);
//Sets the background color.
FormatCondition fc = fcs.get(conditionIndex);
fc.getStyle().setBackgroundColor(Color.getRed());
Top10 top10 = fc.getTop10();
//Set the Top N
top10.setRank(5);
//Saving the Excel file
workbook.save("C:\\output.xls");
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.
Constructor Detail
Top10
public Top10()
Property Getters/Setters Detail
isPercent/setPercent
public boolean isPercent() / public void setPercent(boolean value)
Get or set whether a "top/bottom n" rule is a "top/bottom n percent" rule.
Default value is false.
isBottom/setBottom
public boolean isBottom() / public void setBottom(boolean value)
Get or set whether a "top/bottom n" rule is a "bottom n" rule.
Default value is false.
getRank/setRank
public int getRank() / public void setRank(int value)
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.