public interface SheetConditionalFormatting
Modifier and Type | Method and Description |
---|---|
int |
addConditionalFormatting(CellRangeAddress[] regions,
ConditionalFormattingRule rule)
Add a new Conditional Formatting to the sheet.
|
int |
addConditionalFormatting(CellRangeAddress[] regions,
ConditionalFormattingRule[] cfRules)
Add a new Conditional Formatting set to the sheet.
|
int |
addConditionalFormatting(CellRangeAddress[] regions,
ConditionalFormattingRule rule1,
ConditionalFormattingRule rule2)
Add a new Conditional Formatting consisting of two rules.
|
int |
addConditionalFormatting(ConditionalFormatting cf)
Adds a copy of a ConditionalFormatting object to the sheet
|
ConditionalFormattingRule |
createConditionalFormattingColorScaleRule()
Create a Color Scale / Color Gradient conditional formatting rule.
|
ConditionalFormattingRule |
createConditionalFormattingRule(byte comparisonOperation,
java.lang.String formula)
Create a conditional formatting rule that compares a cell value
to a formula calculated result, using an operator *
|
ConditionalFormattingRule |
createConditionalFormattingRule(byte comparisonOperation,
java.lang.String formula1,
java.lang.String formula2)
A factory method allowing to create a conditional formatting rule
with a cell comparison operator
|
ConditionalFormattingRule |
createConditionalFormattingRule(ExtendedColor color)
Create a Databar conditional formatting rule.
|
ConditionalFormattingRule |
createConditionalFormattingRule(IconMultiStateFormatting.IconSet iconSet)
Create an Icon Set / Multi-State conditional formatting rule.
|
ConditionalFormattingRule |
createConditionalFormattingRule(java.lang.String formula)
Create a conditional formatting rule based on a Boolean formula.
|
ConditionalFormatting |
getConditionalFormattingAt(int index)
Gets Conditional Formatting object at a particular index
|
int |
getNumConditionalFormattings() |
void |
removeConditionalFormatting(int index)
Removes a Conditional Formatting object by index
|
int addConditionalFormatting(CellRangeAddress[] regions, ConditionalFormattingRule rule)
regions
- - list of rectangular regions to apply conditional formatting rulesrule
- - the rule to applyint addConditionalFormatting(CellRangeAddress[] regions, ConditionalFormattingRule rule1, ConditionalFormattingRule rule2)
regions
- - list of rectangular regions to apply conditional formatting rulesrule1
- - the first rulerule2
- - the second ruleint addConditionalFormatting(CellRangeAddress[] regions, ConditionalFormattingRule[] cfRules)
regions
- - list of rectangular regions to apply conditional formatting rulescfRules
- - set of up to conditional formatting rules (max 3 for Excel pre-2007)int addConditionalFormatting(ConditionalFormatting cf)
This method could be used to copy ConditionalFormatting object from one sheet to another. For example:
ConditionalFormatting cf = sheet.getConditionalFormattingAt(index); newSheet.addConditionalFormatting(cf);
cf
- the Conditional Formatting to cloneConditionalFormattingRule createConditionalFormattingRule(byte comparisonOperation, java.lang.String formula1, java.lang.String formula2)
The created conditional formatting rule compares a cell value
to a formula calculated result, using the specified operator.
The type of the created condition is ConditionType.CELL_VALUE_IS
comparisonOperation
- - MUST be a constant value from
ComparisonOperator
:
formula1
- - formula for the valued, compared with the cellformula2
- - second formula (only used with
ComparisonOperator.BETWEEN
) and ComparisonOperator.NOT_BETWEEN
operations)ConditionalFormattingRule createConditionalFormattingRule(byte comparisonOperation, java.lang.String formula)
The type of the created condition is ConditionType.CELL_VALUE_IS
comparisonOperation
- MUST be a constant value from
ComparisonOperator
except BETWEEN and NOT_BETWEENformula
- the formula to determine if the conditional formatting is appliedConditionalFormattingRule createConditionalFormattingRule(java.lang.String formula)
The type of the created format condition is ConditionType.FORMULA
formula
- the formula to evaluate. MUST be a Boolean function.ConditionalFormattingRule createConditionalFormattingRule(ExtendedColor color)
The thresholds and colour for it will be created, but will be
empty and require configuring with
ConditionalFormattingRule.getDataBarFormatting()
then
DataBarFormatting.getMinThreshold()
and
DataBarFormatting.getMaxThreshold()
ConditionalFormattingRule createConditionalFormattingRule(IconMultiStateFormatting.IconSet iconSet)
The thresholds for it will be created, but will be empty
and require configuring with
ConditionalFormattingRule.getMultiStateFormatting()
then
IconMultiStateFormatting.getThresholds()
ConditionalFormattingRule createConditionalFormattingColorScaleRule()
The thresholds and colours for it will be created, but will be
empty and require configuring with
ConditionalFormattingRule.getColorScaleFormatting()
then
ColorScaleFormatting.getThresholds()
and
ColorScaleFormatting.getColors()
ConditionalFormatting getConditionalFormattingAt(int index)
index
- 0-based index of the Conditional Formatting object to fetchnull
if not foundjava.lang.IllegalArgumentException
- if the index is outside of the allowable range (0 ... numberOfFormats-1)int getNumConditionalFormattings()
void removeConditionalFormatting(int index)
index
- 0-based index of the Conditional Formatting object to removejava.lang.IllegalArgumentException
- if the index is outside of the allowable range (0 ... numberOfFormats-1)Copyright 2018 The Apache Software Foundation or its licensors, as applicable.