Interface ConditionalFormattingRule
-
- All Superinterfaces:
DifferentialStyleProvider
- All Known Implementing Classes:
HSSFConditionalFormattingRule
,XSSFConditionalFormattingRule
public interface ConditionalFormattingRule extends DifferentialStyleProvider
Represents a description of a conditional formatting rule
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description BorderFormatting
createBorderFormatting()
Create a new border formatting structure if it does not exist, otherwise just return existing object.FontFormatting
createFontFormatting()
Create a new font formatting structure if it does not exist, otherwise just return existing object.PatternFormatting
createPatternFormatting()
Create a new pattern formatting structure if it does not exist, otherwise just return existing object.BorderFormatting
getBorderFormatting()
ColorScaleFormatting
getColorScaleFormatting()
byte
getComparisonOperation()
The comparison function used when the type of conditional formatting is set toConditionType.CELL_VALUE_IS
ConditionFilterType
getConditionFilterType()
This is null ifConditionType
getConditionType()
Type of conditional formatting rule.DataBarFormatting
getDataBarFormatting()
ConditionFilterData
getFilterConfiguration()
This is null ifFontFormatting
getFontFormatting()
String
getFormula1()
The formula used to evaluate the first operand for the conditional formatting rule.String
getFormula2()
The formula used to evaluate the second operand of the comparison when comparison type isConditionType.CELL_VALUE_IS
and operator is eitherComparisonOperator.BETWEEN
orComparisonOperator.NOT_BETWEEN
IconMultiStateFormatting
getMultiStateFormatting()
ExcelNumberFormat
getNumberFormat()
PatternFormatting
getPatternFormatting()
int
getPriority()
The priority of the rule, if defined, otherwise 0.boolean
getStopIfTrue()
Always true for HSSF rules, optional flag for XSSF rules.String
getText()
XSSF rules store textual condition values as an attribute and also as a formula that needs shifting.-
Methods inherited from interface org.apache.poi.ss.usermodel.DifferentialStyleProvider
getStripeSize
-
-
-
-
Method Detail
-
createBorderFormatting
BorderFormatting createBorderFormatting()
Create a new border formatting structure if it does not exist, otherwise just return existing object.- Returns:
- - border formatting object, never returns
null
.
-
getBorderFormatting
BorderFormatting getBorderFormatting()
- Specified by:
getBorderFormatting
in interfaceDifferentialStyleProvider
- Returns:
- - border formatting object if defined,
null
otherwise
-
createFontFormatting
FontFormatting createFontFormatting()
Create a new font formatting structure if it does not exist, otherwise just return existing object.- Returns:
- - font formatting object, never returns
null
.
-
getFontFormatting
FontFormatting getFontFormatting()
- Specified by:
getFontFormatting
in interfaceDifferentialStyleProvider
- Returns:
- - font formatting object if defined,
null
otherwise
-
createPatternFormatting
PatternFormatting createPatternFormatting()
Create a new pattern formatting structure if it does not exist, otherwise just return existing object.- Returns:
- - pattern formatting object, never returns
null
.
-
getPatternFormatting
PatternFormatting getPatternFormatting()
- Specified by:
getPatternFormatting
in interfaceDifferentialStyleProvider
- Returns:
- - pattern formatting object if defined,
null
otherwise
-
getDataBarFormatting
DataBarFormatting getDataBarFormatting()
- Returns:
- - databar / data-bar formatting object if defined,
null
otherwise
-
getMultiStateFormatting
IconMultiStateFormatting getMultiStateFormatting()
- Returns:
- - icon / multi-state formatting object if defined,
null
otherwise
-
getColorScaleFormatting
ColorScaleFormatting getColorScaleFormatting()
- Returns:
- color scale / color grate formatting object if defined,
null
otherwise
-
getNumberFormat
ExcelNumberFormat getNumberFormat()
- Specified by:
getNumberFormat
in interfaceDifferentialStyleProvider
- Returns:
- number format defined for this rule, or null if the cell default should be used
-
getConditionType
ConditionType getConditionType()
Type of conditional formatting rule.- Returns:
- the type of condition
-
getConditionFilterType
ConditionFilterType getConditionFilterType()
This is null ifgetConditionType()
!=ConditionType.FILTER
This is always
ConditionFilterType.FILTER
for HSSF rules of typeConditionType.FILTER
.For XSSF filter rules, this will indicate the specific type of filter.
- Returns:
- filter type for filter rules, or null if not a filter rule.
-
getFilterConfiguration
ConditionFilterData getFilterConfiguration()
This is null ifgetConditionFilterType()
== nullThis means it is always null for HSSF, which does not define the extended condition types.
This object contains the additional configuration information for XSSF filter conditions.
- Returns:
- the Filter Configuration Data, or null if there isn't any
-
getComparisonOperation
byte getComparisonOperation()
The comparison function used when the type of conditional formatting is set toConditionType.CELL_VALUE_IS
MUST be a constant from
ComparisonOperator
- Returns:
- the conditional format operator
-
getFormula1
String getFormula1()
The formula used to evaluate the first operand for the conditional formatting rule.If the condition type is
ConditionType.CELL_VALUE_IS
, this field is the first operand of the comparison. If type isConditionType.FORMULA
, this formula is used to determine if the conditional formatting is applied.If comparison type is
ConditionType.FORMULA
the formula MUST be a Boolean function- Returns:
- the first formula
-
getFormula2
String getFormula2()
The formula used to evaluate the second operand of the comparison when comparison type isConditionType.CELL_VALUE_IS
and operator is eitherComparisonOperator.BETWEEN
orComparisonOperator.NOT_BETWEEN
- Returns:
- the second formula
-
getText
String getText()
XSSF rules store textual condition values as an attribute and also as a formula that needs shifting. Using the attribute is simpler/faster. HSSF rules don't have this and return null. We can fall back on the formula for those (AFAIK).- Returns:
- condition text if it exists, or null
-
getPriority
int getPriority()
The priority of the rule, if defined, otherwise 0.If priority is 0, just use definition order, as that's how older HSSF rules are evaluated.
For XSSF, this should always be set. For HSSF, only newer style rules have this set, older ones will return 0.
If a rule is created but not yet added to a sheet, this value may not be valid.
- Returns:
- rule priority
-
getStopIfTrue
boolean getStopIfTrue()
Always true for HSSF rules, optional flag for XSSF rules. See Excel help for more.- Returns:
- true if conditional formatting rule processing stops when this one is true, false if not
- See Also:
- Microsoft Excel help
-
-