com.smartxls

## Class ConditionFormat

- java.lang.Object
- - com.smartxls.ConditionFormat

-     public class ConditionFormat
      extends java.lang.Object

  This class represents a conditional format condition and the associated formatting. Conditional cell formats are formats that are applied to a cell only when the value of a cell or formula meets a predetermined set of conditions. A range of cells can be formatted with up to three conditional formats. Conditional formats may inclued font colors and styles and cell border colors, styles and patterns.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static short` | `eOperatorBetween` The format is applied if the cell is greater than or equal to formula1 and less than or equal to formula2.
    `static short` | `eOperatorEqual` The format is applied if the cell is equal to formula1.
    `static short` | `eOperatorGreaterThan` The format is applied if the cell is greater than formula1.
    `static short` | `eOperatorGreaterThanOrEqual` The format is applied if the cell is greater than or equal to formula1.
    `static short` | `eOperatorLessThan` The format is applied if the cell is less than formula1.
    `static short` | `eOperatorLessThanOrEqual` The format is applied if the cell is less than or equal to formula1.
    `static short` | `eOperatorNone` No operator.
    `static short` | `eOperatorNotBetween` The format is applied if the cell is less than formula1 or greater than formula2.
    `static short` | `eOperatorNotEqual` The format is applied if the cell is not equal to formula1.
    `static short` | `eTypeCell` Condition has a type of "Cell".
    `static short` | `eTypeFormula` Condition has a type of "Formula".
    `static short` | `eTypeNone` No condition type.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getFormula1(int row, int col)` Returns the first formula associated with this conditional format
    `java.lang.String` | `getFormula2(int row, int col)` Returns the second formula associated with this conditional format
    `short` | `getOperator()` Returns the operator for this conditional format.
    `RangeStyle` | `getRangeStyle()` Returns the cell format with the formatting options for this conditional format.
    `short` | `getType()` Returns the conditional format type associated with this conditional format.
    `void` | `setColorScale(int conType, java.awt.Color[] colors)` Sets the colorscale's type of this conditional format.
    `void` | `setFormula1(java.lang.String formula, int row, int col)` Sets the first formula associated with this conditional format
    `void` | `setFormula2(java.lang.String formula, int row, int col)` Sets the second formula associated with this conditional format
    `void` | `setOperator(short operator)` Sets the operator for this conditional format.
    `void` | `setRangeStyle(RangeStyle cfmt)` Sets formatting options for this conditional format from the specified RangeStyle object.
    `void` | `setType(short type)` Sets the type of this conditional format.

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

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

- - ### Field Detail

    - #### eTypeNone

          public static final short eTypeNone

      No condition type.
      See Also:
        Constant Field Values

    - #### eTypeCell

          public static final short eTypeCell

      Condition has a type of "Cell". This causes the cell to be compared to the appropriate formula using the specified operator.
      See Also:
        Constant Field Values

    - #### eTypeFormula

          public static final short eTypeFormula

      Condition has a type of "Formula". The first formula is evaluated to determine whether to apply the format. The operator is ignored.
      See Also:
        Constant Field Values

    - #### eOperatorNone

          public static final short eOperatorNone

      No operator.
      See Also:
        Constant Field Values

    - #### eOperatorBetween

          public static final short eOperatorBetween

      The format is applied if the cell is greater than or equal to formula1 and less than or equal to formula2.
      See Also:
        Constant Field Values

    - #### eOperatorNotBetween

          public static final short eOperatorNotBetween

      The format is applied if the cell is less than formula1 or greater than formula2.
      See Also:
        Constant Field Values

    - #### eOperatorEqual

          public static final short eOperatorEqual

      The format is applied if the cell is equal to formula1.
      See Also:
        Constant Field Values

    - #### eOperatorNotEqual

          public static final short eOperatorNotEqual

      The format is applied if the cell is not equal to formula1.
      See Also:
        Constant Field Values

    - #### eOperatorGreaterThan

          public static final short eOperatorGreaterThan

      The format is applied if the cell is greater than formula1.
      See Also:
        Constant Field Values

    - #### eOperatorLessThan

          public static final short eOperatorLessThan

      The format is applied if the cell is less than formula1.
      See Also:
        Constant Field Values

    - #### eOperatorGreaterThanOrEqual

          public static final short eOperatorGreaterThanOrEqual

      The format is applied if the cell is greater than or equal to formula1.
      See Also:
        Constant Field Values

    - #### eOperatorLessThanOrEqual

          public static final short eOperatorLessThanOrEqual

      The format is applied if the cell is less than or equal to formula1.
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### getRangeStyle

          public RangeStyle getRangeStyle()

      Returns the cell format with the formatting options for this conditional format. Note: Only the following attributes of cell formatting are supported by conditional formats: bold, italic, strikeout, underline, font color, border, fill pattern, fill foreground and fill background.
      Returns:
        the RangeStyle object with the format attributes for this conditional format.

    - #### setRangeStyle

          public void setRangeStyle(RangeStyle cfmt)
                             throws java.lang.Exception

      Sets formatting options for this conditional format from the specified RangeStyle object. Note: Only the following attributes of cell formatting are supported by conditional formats: bold, italic, strikeout, underline, font color, border, fill pattern, fill foreground and fill background.
      Parameters:
        `cfmt` - the formatting to apply to this conditional format.
      Throws:
        `java.lang.Exception` - exception

    - #### getType

          public short getType()

      Returns the conditional format type associated with this conditional format.
      Returns:
        a short indicating the type of this conditional format: eTypeNone, eTypeCell or eTypeFormula.

    - #### setType

          public void setType(short type)

      Sets the type of this conditional format.
      Parameters:
        `type` - a short indicating the type of this conditional format: eTypeNone, eTypeCell or eTypeFormula.

    - #### getOperator

          public short getOperator()

      Returns the operator for this conditional format.
      Returns:
        a short indicating the operator.

    - #### setOperator

          public void setOperator(short operator)

      Sets the operator for this conditional format.
      Parameters:
        `operator` - the operator for this conditional format: Conditional Format Operators eOperatorNone eOperatorBetween eOperatorNotBetween eOperatorEqual eOperatorNotEqual eOperatorGreaterThan eOperatorLessThan eOperatorGreaterThanOrEqual eOperatorLessThanOrEqual

    - #### getFormula1

          public java.lang.String getFormula1(int row,
                                              int col)
                                       throws java.lang.Exception

      Returns the first formula associated with this conditional format
      Parameters:
        `row` - the row this formula is relative to.
        `col` - the column this formula is relative to.
      Returns:
        the formula. Returns null if there is no formula.
      Throws:
        `java.lang.Exception` - exception

    - #### setFormula1

          public void setFormula1(java.lang.String formula,
                                  int row,
                                  int col)
                           throws java.lang.Exception

      Sets the first formula associated with this conditional format
      Parameters:
        `formula` - the first formula for this conditional format.
        `row` - the row the formula will be relative to.
        `col` - the column the formula will be relative to.
      Throws:
        `java.lang.Exception` - if there is an error in the formula.

    - #### getFormula2

          public java.lang.String getFormula2(int row,
                                              int col)
                                       throws java.lang.Exception

      Returns the second formula associated with this conditional format
      Parameters:
        `row` - the row this formula is relative to.
        `col` - the column this formula is relative to.
      Returns:
        the formula. Returns null if there is no formula.
      Throws:
        `java.lang.Exception` - exception

    - #### setFormula2

          public void setFormula2(java.lang.String formula,
                                  int row,
                                  int col)
                           throws java.lang.Exception

      Sets the second formula associated with this conditional format
      Parameters:
        `formula` - the first formula for this conditional format.
        `row` - the row the formula will be relative to.
        `col` - the column the formula will be relative to.
      Throws:
        `java.lang.Exception` - if there is an error in the formula.

    - #### setColorScale

          public void setColorScale(int conType,
                                    java.awt.Color[] colors)

      Sets the colorscale's type of this conditional format.
      Parameters:
        `conType` - 2 or 3.
        `colors` - colors to be set