Top Description Methods
org.apache.poi.ss.usermodel

public Interface ConditionalFormattingRule

extends DifferentialStyleProvider
Known Direct Implementers
org.apache.poi.hssf.usermodel.HSSFConditionalFormattingRule

Represents a description of a conditional formatting rule

Method Summary

Modifier and TypeMethod and Description
public BorderFormatting

Returns:

- border formatting object, never returns null.
createBorderFormatting
()

Create a new border formatting structure if it does not exist, otherwise just return existing object.

public FontFormatting

Returns:

- font formatting object, never returns null.
createFontFormatting
()

Create a new font formatting structure if it does not exist, otherwise just return existing object.

public PatternFormatting

Returns:

- pattern formatting object, never returns null.
createPatternFormatting
()

Create a new pattern formatting structure if it does not exist, otherwise just return existing object.

public BorderFormatting

Returns:

- border formatting object if defined, null otherwise
getBorderFormatting
()

Redeclares org.apache.poi.ss.usermodel.DifferentialStyleProvider.getBorderFormatting.

public ColorScaleFormatting

Returns:

color scale / color grate formatting object if defined, null otherwise
getColorScaleFormatting
()

public byte

Returns:

the conditional format operator
getComparisonOperation
()

The comparison function used when the type of conditional formatting is set to ConditionType#CELL_VALUE_IS

MUST be a constant from ComparisonOperator

public ConditionFilterType

Returns:

filter type for filter rules, or null if not a filter rule.
getConditionFilterType
()

This is null if

getConditionType() != ConditionType#FILTER

This is always ConditionFilterType#FILTER for HSSF rules of type ConditionType#FILTER.

public ConditionType

Returns:

the type of condition
getConditionType
()

Type of conditional formatting rule.

public DataBarFormatting

Returns:

- databar / data-bar formatting object if defined, null otherwise
getDataBarFormatting
()

public ConditionFilterData

Returns:

the Filter Configuration Data, or null if there isn't any
getFilterConfiguration
()

This is null if

getConditionFilterType() == null

This means it is always null for HSSF, which does not define the extended condition types.

public FontFormatting

Returns:

- font formatting object if defined, null otherwise
getFontFormatting
()

Redeclares org.apache.poi.ss.usermodel.DifferentialStyleProvider.getFontFormatting.

public String

Returns:

the first formula
getFormula1
()

The formula used to evaluate the first operand for the conditional formatting rule.

public String

Returns:

the second formula
getFormula2
()

The formula used to evaluate the second operand of the comparison when comparison type is ConditionType#CELL_VALUE_IS and operator is either ComparisonOperator#BETWEEN or ComparisonOperator#NOT_BETWEEN

public IconMultiStateFormatting

Returns:

- icon / multi-state formatting object if defined, null otherwise
getMultiStateFormatting
()

public ExcelNumberFormat

Returns:

number format defined for this rule, or null if the cell default should be used
getNumberFormat
()

Redeclares org.apache.poi.ss.usermodel.DifferentialStyleProvider.getNumberFormat.

public PatternFormatting

Returns:

- pattern formatting object if defined, null otherwise
getPatternFormatting
()

Redeclares org.apache.poi.ss.usermodel.DifferentialStyleProvider.getPatternFormatting.

public int

Returns:

rule priority
getPriority
()

The priority of the rule, if defined, otherwise 0.

public boolean

Returns:

true if conditional formatting rule processing stops when this one is true, false if not
getStopIfTrue
()

Always true for HSSF rules, optional flag for XSSF rules.

public String

Returns:

condition text if it exists, or null
getText
()

XSSF rules store textual condition values as an attribute and also as a formula that needs shifting.

Inherited from org.apache.poi.ss.usermodel.DifferentialStyleProvider:
getStripeSize

Method Detail

createBorderFormattingback to summary
public BorderFormatting createBorderFormatting()

Create a new border formatting structure if it does not exist, otherwise just return existing object.

Returns:BorderFormatting

- border formatting object, never returns null.

createFontFormattingback to summary
public FontFormatting createFontFormatting()

Create a new font formatting structure if it does not exist, otherwise just return existing object.

Returns:FontFormatting

- font formatting object, never returns null.

createPatternFormattingback to summary
public PatternFormatting createPatternFormatting()

Create a new pattern formatting structure if it does not exist, otherwise just return existing object.

Returns:PatternFormatting

- pattern formatting object, never returns null.

getBorderFormattingback to summary
public BorderFormatting getBorderFormatting()

Redeclares org.apache.poi.ss.usermodel.DifferentialStyleProvider.getBorderFormatting.

Returns:BorderFormatting

- border formatting object if defined, null otherwise

getColorScaleFormattingback to summary
public ColorScaleFormatting getColorScaleFormatting()
Returns:ColorScaleFormatting

color scale / color grate formatting object if defined, null otherwise

getComparisonOperationback to summary
public byte getComparisonOperation()

The comparison function used when the type of conditional formatting is set to ConditionType#CELL_VALUE_IS

MUST be a constant from ComparisonOperator

Returns:byte

the conditional format operator

getConditionFilterTypeback to summary
public ConditionFilterType getConditionFilterType()

This is null if

getConditionType() != ConditionType#FILTER

This is always ConditionFilterType#FILTER for HSSF rules of type ConditionType#FILTER.

For XSSF filter rules, this will indicate the specific type of filter.

Returns:ConditionFilterType

filter type for filter rules, or null if not a filter rule.

getConditionTypeback to summary
public ConditionType getConditionType()

Type of conditional formatting rule.

Returns:ConditionType

the type of condition

getDataBarFormattingback to summary
public DataBarFormatting getDataBarFormatting()
Returns:DataBarFormatting

- databar / data-bar formatting object if defined, null otherwise

getFilterConfigurationback to summary
public ConditionFilterData getFilterConfiguration()

This is null if

getConditionFilterType() == null

This 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:ConditionFilterData

the Filter Configuration Data, or null if there isn't any

getFontFormattingback to summary
public FontFormatting getFontFormatting()

Redeclares org.apache.poi.ss.usermodel.DifferentialStyleProvider.getFontFormatting.

Returns:FontFormatting

- font formatting object if defined, null otherwise

getFormula1back to summary
public 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 is ConditionType#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:String

the first formula

getFormula2back to summary
public String getFormula2()

The formula used to evaluate the second operand of the comparison when comparison type is ConditionType#CELL_VALUE_IS and operator is either ComparisonOperator#BETWEEN or ComparisonOperator#NOT_BETWEEN

Returns:String

the second formula

getMultiStateFormattingback to summary
public IconMultiStateFormatting getMultiStateFormatting()
Returns:IconMultiStateFormatting

- icon / multi-state formatting object if defined, null otherwise

getNumberFormatback to summary
public ExcelNumberFormat getNumberFormat()

Redeclares org.apache.poi.ss.usermodel.DifferentialStyleProvider.getNumberFormat.

Returns:ExcelNumberFormat

number format defined for this rule, or null if the cell default should be used

getPatternFormattingback to summary
public PatternFormatting getPatternFormatting()

Redeclares org.apache.poi.ss.usermodel.DifferentialStyleProvider.getPatternFormatting.

Returns:PatternFormatting

- pattern formatting object if defined, null otherwise

getPriorityback to summary
public 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:int

rule priority

getStopIfTrueback to summary
public boolean getStopIfTrue()

Always true for HSSF rules, optional flag for XSSF rules. See Excel help for more.

Returns:boolean

true if conditional formatting rule processing stops when this one is true, false if not

See Also
Microsoft Excel help
getTextback to summary
public 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:String

condition text if it exists, or null