public final class ConditionalFormatRule extends Object
Modifier and Type | Method and Description |
---|---|
String |
getAppliesTo()
Gets the sequence of references to cell ranges over which this conditional formatting rule is applied.
|
FormatCondition |
getCondition()
Gets the condition specified in this conditional formatting rule.
|
boolean |
isStopIfTrue()
Gets a value indicating whether a rule with lower priority may be applied over this rule, when this rule evaluates to true.
|
ColorScaleCondition |
set2ColorScale()
Sets a '2-Color Scale' formatting condition to this conditional formatting rule.
|
ColorScaleCondition |
set3ColorScale()
Sets a '3-Color Scale' formatting condition to this conditional formatting rule.
|
AboveOrBelowAverageCondition |
setAboveOrBelowAverage(boolean below)
Sets an 'Above or Below Average' formatting condition to this conditional formatting rule.
|
void |
setAppliesTo(String appliesTo)
Sets the sequence of references to cell ranges over which this conditional formatting rule is applied.
|
ContainCondition |
setContain(ContainConditionType containConditionType)
Sets a 'Cells with Blanks' or 'Cells with No Blanks' or 'Cells with Errors' or 'Cells with No Errors' formatting condition to this conditional formatting rule.
|
ContainDateCondition |
setContainDate(ContainDateOperator operator)
Sets a 'Cells with Dates Occurring' formatting condition to this conditional formatting rule.
|
ContainTextCondition |
setContainText(ContainTextOperator operator,
String value)
Sets a 'Cells with Specific Text' formatting condition to this conditional formatting rule.
|
ContainValueCondition |
setContainValue(ContainValueOperator operator,
Object value)
Sets a 'Cells with Cell Value' formatting condition to this conditional formatting rule.
|
ContainValueCondition |
setContainValue(ContainValueOperator operator,
Object value,
Object value2)
Sets a 'Cells with Cell Value' formatting condition to this conditional formatting rule.
|
DataBarCondition |
setDataBar()
Sets a 'Data Bar' formatting condition to this conditional formatting rule.
|
FormulaCondition |
setFormula(String formula)
Sets a 'Formula' formatting condition to this conditional formatting rule.
|
IconSetCondition |
setIconSet()
Sets an 'Icon Set' formatting condition to this conditional formatting rule.
|
void |
setStopIfTrue(boolean stopIfTrue)
Sets a value indicating whether a rule with lower priority may be applied over this rule, when this rule evaluates to true.
|
TopOrBottomRankedCondition |
setTopOrBottomRanked(boolean bottom,
int rank)
Sets a 'Top or Bottom Ranked' formatting condition to this conditional formatting rule.
|
UniqueOrDuplicateCondition |
setUniqueOrDuplicate(boolean duplicate)
Sets a 'Unique or Duplicate' formatting condition to this conditional formatting rule.
|
String |
toString()
Returns a
String that represents this ConditionalFormatRule instance. |
public String getAppliesTo()
public FormatCondition getCondition()
public boolean isStopIfTrue()
true
if no rules with lower priority may be applied over this rule, when this rule evaluates to true; otherwise, false
.public ColorScaleCondition set2ColorScale()
Newly set condition has the same default settings as in MS Excel.
ColorScaleCondition
set to this conditional formatting rule which can be used to further customize the formatting condition.public ColorScaleCondition set3ColorScale()
Newly set condition has the same default settings as in MS Excel.
ColorScaleCondition
set to this conditional formatting rule which can be used to further customize the formatting condition.public AboveOrBelowAverageCondition setAboveOrBelowAverage(boolean below)
below
- if set to true
format cells with values below average; otherwise, format cells with values above average.AboveOrBelowAverageCondition
set to this conditional formatting rule which can be used to further customize the formatting condition.public void setAppliesTo(String appliesTo)
appliesTo
- The sequence of references to cell ranges over which this conditional formatting rule is applied.IllegalArgumentException
- Parameter is null
or empty String.public ContainCondition setContain(ContainConditionType containConditionType)
containConditionType
- The contain condition type (ContainConditionType.BLANKS
or ContainConditionType.NO_BLANKS
or ContainConditionType.ERRORS
or ContainConditionType.NO_ERRORS
).ContainCondition
set to this conditional formatting rule which can be used to customize the formatting.IllegalArgumentException
- Parameter containConditionType
is not ContainConditionType.BLANKS
or ContainConditionType.NO_BLANKS
or ContainConditionType.ERRORS
or ContainConditionType.NO_ERRORS
.public ContainDateCondition setContainDate(ContainDateOperator operator)
operator
- The date operator.ContainDateCondition
set to this conditional formatting rule which can be used to customize the formatting.public ContainTextCondition setContainText(ContainTextOperator operator, String value)
Value can be either constant or formula.
If value is constant, then it cannot be null
.
If value is formula, it must start with '='.
operator
- The textual operator.value
- The value (constant string or formula).ContainTextCondition
set to this conditional formatting rule which can be used to customize the formatting.NullPointerException
- Parameter value
is null
.public ContainValueCondition setContainValue(ContainValueOperator operator, Object value)
Value can be either constant or formula.
If value is constant, then it cannot be null
and value's type must be supported in ExcelCell's value
(types supported in ExcelFile.supportsType(Class)
).
If value is formula, then value type must be String
and it must start with '='.
operator
- The operator (all except ContainValueOperator.BETWEEN
and ContainValueOperator.NOT_BETWEEN
).value
- The value (constant or formula).ContainValueCondition
set to this conditional formatting rule which can be used to customize the formatting.IllegalArgumentException
- Parameter operator
is ContainValueOperator.BETWEEN
or ContainValueOperator.NOT_BETWEEN
. Use other method overload for these operators.NullPointerException
- Parameter value
is null
.IllegalArgumentException
- Parameter value
type is not supported.public ContainValueCondition setContainValue(ContainValueOperator operator, Object value, Object value2)
Values can be either constant or formula.
If value is constant, then it cannot be null
and value's type must be supported in ExcelCell's value
(types supported in ExcelFile.supportsType(Class)
).
If value is formula, then value type must be String
and it must start with '='.
operator
- The operator (ContainValueOperator.BETWEEN
or ContainValueOperator.NOT_BETWEEN
).value
- The value (constant or formula).value2
- The second value (constant or formula).ContainValueCondition
set to this conditional formatting rule which can be used to customize the formatting.IllegalArgumentException
- Parameter operator
is not ContainValueOperator.BETWEEN
nor ContainValueOperator.NOT_BETWEEN
. Use other method overload for other operators.NullPointerException
- Parameter value
or value2
is null
.IllegalArgumentException
- Parameter value
or value2
type is not supported.public DataBarCondition setDataBar()
Newly set condition has the same default settings as in MS Excel.
DataBarCondition
set to this conditional formatting rule which can be used to further customize the formatting condition.public FormulaCondition setFormula(String formula)
formula
- The formula used to determine which cells to format (only cells for which the formula result evaluates to true
are formatted).FormulaCondition
set to this conditional formatting rule which can be used to customize the formatting.IllegalArgumentException
- Parameter formula
is null
or empty string.public IconSetCondition setIconSet()
Newly set condition has the same default settings as in MS Excel.
IconSetCondition
set to this conditional formatting rule which can be used to further customize the formatting condition.public void setStopIfTrue(boolean stopIfTrue)
stopIfTrue
- true
if no rules with lower priority may be applied over this rule, when this rule evaluates to true; otherwise, false
.public TopOrBottomRankedCondition setTopOrBottomRanked(boolean bottom, int rank)
bottom
- if set to true
format cells with bottom ranked values; otherwise, format cells with top ranked values.rank
- The number of top or bottom ranked cells which are formatted.TopOrBottomRankedCondition
set to this conditional formatting rule which can be used to further customize the formatting condition.IndexOutOfBoundsException
- Parameter rank
is less than or equal to zero.public UniqueOrDuplicateCondition setUniqueOrDuplicate(boolean duplicate)
duplicate
- if set to true
format cells with duplicate values; otherwise, format cells with unique values.UniqueOrDuplicateCondition
set to this conditional formatting rule which can be used to customize the formatting.public String toString()
String
that represents this ConditionalFormatRule
instance.
This method should be used primarily for debugging purposes and should be considered volatile (format of its return value might change in future versions).
toString
in class Object
String
that represents this ConditionalFormatRule
instance.© GemBox Ltd. — All rights reserved.