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 Details

    • 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 interface DifferentialStyleProvider
      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 interface DifferentialStyleProvider
      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 interface DifferentialStyleProvider
      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 interface DifferentialStyleProvider
      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 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:
      filter type for filter rules, or null if not a filter rule.
    • getFilterConfiguration

      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:
      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 to ConditionType.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 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:
      the first formula
    • getFormula2

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