org.apache.poi.xssf.usermodel

## Class XSSFConditionalFormattingRule

- java.lang.Object
- - org.apache.poi.xssf.usermodel.XSSFConditionalFormattingRule

- All Implemented Interfaces:
    ConditionalFormattingRule, DifferentialStyleProvider

      public class XSSFConditionalFormattingRule
      extends java.lang.Object
      implements ConditionalFormattingRule

  XSSF support for Conditional Formatting rules

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `XSSFBorderFormatting` | `createBorderFormatting()` Create a new border formatting structure if it does not exist, otherwise just return existing object.
    `XSSFColorScaleFormatting` | `createColorScaleFormatting()`
    `XSSFDataBarFormatting` | `createDataBarFormatting(XSSFColor color)`
    `XSSFFontFormatting` | `createFontFormatting()` Create a new font formatting structure if it does not exist, otherwise just return existing object.
    `XSSFIconMultiStateFormatting` | `createMultiStateFormatting(IconMultiStateFormatting.IconSet iconSet)`
    `XSSFPatternFormatting` | `createPatternFormatting()` Create a new pattern formatting structure if it does not exist, otherwise just return existing object.
    `XSSFBorderFormatting` | `getBorderFormatting()`
    `XSSFColorScaleFormatting` | `getColorScaleFormatting()`
    `byte` | `getComparisonOperation()` The comparison function used when the type of conditional formatting is set to `ConditionType.CELL_VALUE_IS`
    `ConditionFilterType` | `getConditionFilterType()` Will return null if `getConditionType()` != `ConditionType.FILTER`
    `ConditionType` | `getConditionType()` Type of conditional formatting rule.
    `XSSFDataBarFormatting` | `getDataBarFormatting()`
    `ConditionFilterData` | `getFilterConfiguration()` This is null if
    `XSSFFontFormatting` | `getFontFormatting()`
    `java.lang.String` | `getFormula1()` The formula used to evaluate the first operand for the conditional formatting rule.
    `java.lang.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`
    `XSSFIconMultiStateFormatting` | `getMultiStateFormatting()`
    `ExcelNumberFormat` | `getNumberFormat()` Return the number format from the dxf style record if present, null if not
    `XSSFPatternFormatting` | `getPatternFormatting()`
    `int` | `getPriority()` The priority of the rule, if defined, otherwise 0.
    `boolean` | `getStopIfTrue()` Always true for HSSF rules, optional flag for XSSF rules.
    `int` | `getStripeSize()` Conditional format rules don't define stripes, so always 0
    `java.lang.String` | `getText()` XSSF rules store textual condition values as an attribute and also as a formula that needs shifting.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### getPriority

          public int getPriority()

      Description copied from interface: `ConditionalFormattingRule`
      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.

      Specified by:
        `getPriority` in interface `ConditionalFormattingRule`
      Returns:
        rule priority

    - #### getStopIfTrue

          public boolean getStopIfTrue()

      Description copied from interface: `ConditionalFormattingRule`
      Always true for HSSF rules, optional flag for XSSF rules. See Excel help for more.
      Specified by:
        `getStopIfTrue` in interface `ConditionalFormattingRule`
      Returns:
        true if conditional formatting rule processing stops when this one is true, false if not
      See Also:
        Microsoft Excel help

    - #### createBorderFormatting

          public XSSFBorderFormatting createBorderFormatting()

      Create a new border formatting structure if it does not exist, otherwise just return existing object.
      Specified by:
        `createBorderFormatting` in interface `ConditionalFormattingRule`
      Returns:
        - border formatting object, never returns `null`.

    - #### getBorderFormatting

          public XSSFBorderFormatting getBorderFormatting()

      Specified by:
        `getBorderFormatting` in interface `ConditionalFormattingRule`
      Specified by:
        `getBorderFormatting` in interface `DifferentialStyleProvider`
      Returns:
        - border formatting object if defined, `null` otherwise

    - #### createFontFormatting

          public XSSFFontFormatting createFontFormatting()

      Create a new font formatting structure if it does not exist, otherwise just return existing object.
      Specified by:
        `createFontFormatting` in interface `ConditionalFormattingRule`
      Returns:
        - font formatting object, never returns `null`.

    - #### getFontFormatting

          public XSSFFontFormatting getFontFormatting()

      Specified by:
        `getFontFormatting` in interface `ConditionalFormattingRule`
      Specified by:
        `getFontFormatting` in interface `DifferentialStyleProvider`
      Returns:
        - font formatting object if defined, `null` otherwise

    - #### createPatternFormatting

          public XSSFPatternFormatting createPatternFormatting()

      Create a new pattern formatting structure if it does not exist, otherwise just return existing object.
      Specified by:
        `createPatternFormatting` in interface `ConditionalFormattingRule`
      Returns:
        - pattern formatting object, never returns `null`.

    - #### getPatternFormatting

          public XSSFPatternFormatting getPatternFormatting()

      Specified by:
        `getPatternFormatting` in interface `ConditionalFormattingRule`
      Specified by:
        `getPatternFormatting` in interface `DifferentialStyleProvider`
      Returns:
        - pattern formatting object if defined, `null` otherwise

    - #### createDataBarFormatting

          public XSSFDataBarFormatting createDataBarFormatting(XSSFColor color)

      Parameters:
        `color` -
      Returns:
        data bar formatting

    - #### getDataBarFormatting

          public XSSFDataBarFormatting getDataBarFormatting()

      Specified by:
        `getDataBarFormatting` in interface `ConditionalFormattingRule`
      Returns:
        - databar / data-bar formatting object if defined, `null` otherwise

    - #### createMultiStateFormatting

          public XSSFIconMultiStateFormatting createMultiStateFormatting(IconMultiStateFormatting.IconSet iconSet)

    - #### getMultiStateFormatting

          public XSSFIconMultiStateFormatting getMultiStateFormatting()

      Specified by:
        `getMultiStateFormatting` in interface `ConditionalFormattingRule`
      Returns:
        - icon / multi-state formatting object if defined, `null` otherwise

    - #### createColorScaleFormatting

          public XSSFColorScaleFormatting createColorScaleFormatting()

    - #### getColorScaleFormatting

          public XSSFColorScaleFormatting getColorScaleFormatting()

      Specified by:
        `getColorScaleFormatting` in interface `ConditionalFormattingRule`
      Returns:
        color scale / color grate formatting object if defined, `null` otherwise

    - #### getNumberFormat

          public ExcelNumberFormat getNumberFormat()

      Return the number format from the dxf style record if present, null if not
      Specified by:
        `getNumberFormat` in interface `ConditionalFormattingRule`
      Specified by:
        `getNumberFormat` in interface `DifferentialStyleProvider`
      Returns:
        number format defined for this rule, or null if the cell default should be used
      See Also:
        `ConditionalFormattingRule.getNumberFormat()`

    - #### getConditionType

          public ConditionType getConditionType()

      Type of conditional formatting rule.
      Specified by:
        `getConditionType` in interface `ConditionalFormattingRule`
      Returns:
        the type of condition

    - #### getConditionFilterType

          public ConditionFilterType getConditionFilterType()

      Will return null if `getConditionType()` != `ConditionType.FILTER`
      Specified by:
        `getConditionFilterType` in interface `ConditionalFormattingRule`
      Returns:
        filter type for filter rules, or null if not a filter rule.
      See Also:
        `ConditionalFormattingRule.getConditionFilterType()`

    - #### getFilterConfiguration

          public ConditionFilterData getFilterConfiguration()

      Description copied from interface: `ConditionalFormattingRule`
      This is null if

      ``ConditionalFormattingRule.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.

      Specified by:
        `getFilterConfiguration` in interface `ConditionalFormattingRule`
      Returns:
        the Filter Configuration Data, or null if there isn't any

    - #### getComparisonOperation

          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`

      Specified by:
        `getComparisonOperation` in interface `ConditionalFormattingRule`
      Returns:
        the conditional format operator

    - #### getFormula1

          public java.lang.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

      Specified by:
        `getFormula1` in interface `ConditionalFormattingRule`
      Returns:
        the first formula

    - #### getFormula2

          public java.lang.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`
      Specified by:
        `getFormula2` in interface `ConditionalFormattingRule`
      Returns:
        the second formula

    - #### getText

          public java.lang.String getText()

      Description copied from interface: `ConditionalFormattingRule`
      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).
      Specified by:
        `getText` in interface `ConditionalFormattingRule`
      Returns:
        condition text if it exists, or null

    - #### getStripeSize

          public int getStripeSize()

      Conditional format rules don't define stripes, so always 0
      Specified by:
        `getStripeSize` in interface `DifferentialStyleProvider`
      Returns:
        number of rows/columns in a stripe for stripe styles, 0 for all others
      See Also:
        `DifferentialStyleProvider.getStripeSize()`

Copyright 2020 The Apache Software Foundation or its licensors, as applicable.