org.apache.poi.hssf.usermodel
Class HSSFConditionalFormattingRule

java.lang.Object
  extended by org.apache.poi.hssf.usermodel.HSSFConditionalFormattingRule
All Implemented Interfaces:
ConditionalFormattingRule

public final class HSSFConditionalFormattingRule
extends java.lang.Object
implements ConditionalFormattingRule

High level representation of Conditional Formatting Rule. It allows to specify formula based conditions for the Conditional Formatting and the formatting settings such as font, border and pattern.


Field Summary
 
Fields inherited from interface org.apache.poi.ss.usermodel.ConditionalFormattingRule
CONDITION_TYPE_CELL_VALUE_IS, CONDITION_TYPE_FORMULA
 
Method Summary
 HSSFBorderFormatting createBorderFormatting()
          create a new border formatting structure if it does not exist, otherwise just return existing object.
 HSSFColorScaleFormatting createColorScaleFormatting()
          create a new color scale / gradient formatting object if it does not exist, otherwise just return the existing object.
 HSSFDataBarFormatting createDataBarFormatting()
          create a new databar / data-bar formatting object if it does not exist, otherwise just return the existing object.
 HSSFFontFormatting createFontFormatting()
          create a new font formatting structure if it does not exist, otherwise just return existing object.
 HSSFIconMultiStateFormatting createMultiStateFormatting()
          create a new icon / multi-state formatting object if it does not exist, otherwise just return the existing object.
 HSSFPatternFormatting createPatternFormatting()
          create a new pattern formatting structure if it does not exist, otherwise just return existing object.
 HSSFBorderFormatting getBorderFormatting()
           
 HSSFColorScaleFormatting getColorScaleFormatting()
           
 byte getComparisonOperation()
          The comparison function used when the type of conditional formatting is set to ConditionalFormattingRule.CONDITION_TYPE_CELL_VALUE_IS
 byte getConditionType()
          Type of conditional formatting rule.
 ConditionType getConditionTypeType()
          Type of conditional formatting rule.
 HSSFDataBarFormatting getDataBarFormatting()
           
 HSSFFontFormatting 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 ConditionalFormattingRule.CONDITION_TYPE_CELL_VALUE_IS and operator is either ComparisonOperator.BETWEEN or ComparisonOperator.NOT_BETWEEN
 HSSFIconMultiStateFormatting getMultiStateFormatting()
           
 HSSFPatternFormatting getPatternFormatting()
           
protected  java.lang.String toFormulaString(Ptg[] parsedExpression)
           
protected static java.lang.String toFormulaString(Ptg[] parsedExpression, HSSFWorkbook workbook)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFontFormatting

public HSSFFontFormatting getFontFormatting()
Specified by:
getFontFormatting in interface ConditionalFormattingRule
Returns:
- font formatting object if defined, null otherwise

createFontFormatting

public HSSFFontFormatting 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.

getBorderFormatting

public HSSFBorderFormatting getBorderFormatting()
Specified by:
getBorderFormatting in interface ConditionalFormattingRule
Returns:
- border formatting object if defined, null otherwise

createBorderFormatting

public HSSFBorderFormatting 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.

getPatternFormatting

public HSSFPatternFormatting getPatternFormatting()
Specified by:
getPatternFormatting in interface ConditionalFormattingRule
Returns:
- pattern formatting object if defined, null otherwise

createPatternFormatting

public HSSFPatternFormatting 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.

getDataBarFormatting

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

createDataBarFormatting

public HSSFDataBarFormatting createDataBarFormatting()
create a new databar / data-bar formatting object if it does not exist, otherwise just return the existing object.


getMultiStateFormatting

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

createMultiStateFormatting

public HSSFIconMultiStateFormatting createMultiStateFormatting()
create a new icon / multi-state formatting object if it does not exist, otherwise just return the existing object.


getColorScaleFormatting

public HSSFColorScaleFormatting getColorScaleFormatting()
Specified by:
getColorScaleFormatting in interface ConditionalFormattingRule
Returns:
color scale / gradient formatting object if defined, null otherwise

createColorScaleFormatting

public HSSFColorScaleFormatting createColorScaleFormatting()
create a new color scale / gradient formatting object if it does not exist, otherwise just return the existing object.


getConditionType

public byte getConditionType()
Description copied from interface: ConditionalFormattingRule
Type of conditional formatting rule.

MUST be one of the IDs of a ConditionType

Specified by:
getConditionType in interface ConditionalFormattingRule
Returns:
- the conditiontype for the cfrule

getConditionTypeType

public ConditionType getConditionTypeType()
Description copied from interface: ConditionalFormattingRule
Type of conditional formatting rule.

Specified by:
getConditionTypeType in interface ConditionalFormattingRule
Returns:
- the conditiontype for the cfrule

getComparisonOperation

public byte getComparisonOperation()
Description copied from interface: ConditionalFormattingRule
The comparison function used when the type of conditional formatting is set to ConditionalFormattingRule.CONDITION_TYPE_CELL_VALUE_IS

MUST be a constant from ComparisonOperator

Specified by:
getComparisonOperation in interface ConditionalFormattingRule
Returns:
- the comparisionoperatation for the cfrule

getFormula1

public java.lang.String getFormula1()
Description copied from interface: ConditionalFormattingRule
The formula used to evaluate the first operand for the conditional formatting rule.

If the condition type is ConditionalFormattingRule.CONDITION_TYPE_CELL_VALUE_IS, this field is the first operand of the comparison. If type is ConditionalFormattingRule.CONDITION_TYPE_FORMULA, this formula is used to determine if the conditional formatting is applied.

If comparison type is ConditionalFormattingRule.CONDITION_TYPE_FORMULA the formula MUST be a Boolean function

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

getFormula2

public java.lang.String getFormula2()
Description copied from interface: ConditionalFormattingRule
The formula used to evaluate the second operand of the comparison when comparison type is ConditionalFormattingRule.CONDITION_TYPE_CELL_VALUE_IS and operator is either ComparisonOperator.BETWEEN or ComparisonOperator.NOT_BETWEEN

Specified by:
getFormula2 in interface ConditionalFormattingRule
Returns:
the second formula

toFormulaString

protected java.lang.String toFormulaString(Ptg[] parsedExpression)

toFormulaString

protected static java.lang.String toFormulaString(Ptg[] parsedExpression,
                                                  HSSFWorkbook workbook)


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