public final class HSSFSheetConditionalFormatting extends java.lang.Object implements SheetConditionalFormatting
HSSFSheet
Modifier and Type | Method and Description |
---|---|
int |
addConditionalFormatting(CellRangeAddress[] regions,
ConditionalFormattingRule rule1)
Add a new Conditional Formatting to the sheet.
|
int |
addConditionalFormatting(CellRangeAddress[] regions,
ConditionalFormattingRule[] cfRules)
Add a new Conditional Formatting set to the sheet.
|
int |
addConditionalFormatting(CellRangeAddress[] regions,
ConditionalFormattingRule rule1,
ConditionalFormattingRule rule2)
Add a new Conditional Formatting consisting of two rules.
|
int |
addConditionalFormatting(CellRangeAddress[] regions,
HSSFConditionalFormattingRule rule1) |
int |
addConditionalFormatting(CellRangeAddress[] regions,
HSSFConditionalFormattingRule[] cfRules)
Allows to add a new Conditional Formatting set to the sheet.
|
int |
addConditionalFormatting(CellRangeAddress[] regions,
HSSFConditionalFormattingRule rule1,
HSSFConditionalFormattingRule rule2) |
int |
addConditionalFormatting(ConditionalFormatting cf)
Adds a copy of a ConditionalFormatting object to the sheet
|
int |
addConditionalFormatting(HSSFConditionalFormatting cf)
Adds a copy of HSSFConditionalFormatting object to the sheet
|
HSSFConditionalFormattingRule |
createConditionalFormattingColorScaleRule()
Create a Color Scale / Color Gradient conditional formatting rule.
|
HSSFConditionalFormattingRule |
createConditionalFormattingRule(byte comparisonOperation,
java.lang.String formula1)
Create a conditional formatting rule that compares a cell value
to a formula calculated result, using an operator *
|
HSSFConditionalFormattingRule |
createConditionalFormattingRule(byte comparisonOperation,
java.lang.String formula1,
java.lang.String formula2)
A factory method allowing to create a conditional formatting rule
with a cell comparison operator
|
HSSFConditionalFormattingRule |
createConditionalFormattingRule(ExtendedColor color)
Create a Databar conditional formatting rule.
|
HSSFConditionalFormattingRule |
createConditionalFormattingRule(HSSFExtendedColor color)
Create a Databar conditional formatting rule.
|
HSSFConditionalFormattingRule |
createConditionalFormattingRule(IconMultiStateFormatting.IconSet iconSet)
A factory method allowing the creation of conditional formatting
rules using an Icon Set / Multi-State formatting.
|
HSSFConditionalFormattingRule |
createConditionalFormattingRule(java.lang.String formula)
A factory method allowing to create a conditional formatting rule with a formula.
The formatting rules are applied by Excel when the value of the formula not equal to 0. |
HSSFConditionalFormatting |
getConditionalFormattingAt(int index)
gets Conditional Formatting object at a particular index
|
int |
getNumConditionalFormattings() |
void |
removeConditionalFormatting(int index)
removes a Conditional Formatting object by index
|
public HSSFConditionalFormattingRule createConditionalFormattingRule(byte comparisonOperation, java.lang.String formula1, java.lang.String formula2)
TODO - formulas containing cell references are currently not parsed properly
createConditionalFormattingRule
in interface SheetConditionalFormatting
comparisonOperation
- - a constant value from
{@link org.apache.poi.hssf.record.CFRuleBase.ComparisonOperator}
:
formula1
- - formula for the valued, compared with the cellformula2
- - second formula (only used with
CFRuleBase.ComparisonOperator.BETWEEN
) and
CFRuleBase.ComparisonOperator.NOT_BETWEEN
operations)public HSSFConditionalFormattingRule createConditionalFormattingRule(byte comparisonOperation, java.lang.String formula1)
SheetConditionalFormatting
The type of the created condition is ConditionType.CELL_VALUE_IS
createConditionalFormattingRule
in interface SheetConditionalFormatting
comparisonOperation
- MUST be a constant value from
ComparisonOperator
except BETWEEN and NOT_BETWEENformula1
- the formula to determine if the conditional formatting is appliedpublic HSSFConditionalFormattingRule createConditionalFormattingRule(java.lang.String formula)
TODO - formulas containing cell references are currently not parsed properly
createConditionalFormattingRule
in interface SheetConditionalFormatting
formula
- - formula for the valued, compared with the cellpublic HSSFConditionalFormattingRule createConditionalFormattingRule(IconMultiStateFormatting.IconSet iconSet)
HSSFConditionalFormattingRule.getMultiStateFormatting()
then
HSSFIconMultiStateFormatting.getThresholds()
createConditionalFormattingRule
in interface SheetConditionalFormatting
public HSSFConditionalFormattingRule createConditionalFormattingRule(HSSFExtendedColor color)
The thresholds and colour for it will be created, but will be
empty and require configuring with
HSSFConditionalFormattingRule.getDataBarFormatting()
then
HSSFDataBarFormatting.getMinThreshold()
and
HSSFDataBarFormatting.getMaxThreshold()
public HSSFConditionalFormattingRule createConditionalFormattingRule(ExtendedColor color)
SheetConditionalFormatting
The thresholds and colour for it will be created, but will be
empty and require configuring with
ConditionalFormattingRule.getDataBarFormatting()
then
DataBarFormatting.getMinThreshold()
and
DataBarFormatting.getMaxThreshold()
createConditionalFormattingRule
in interface SheetConditionalFormatting
public HSSFConditionalFormattingRule createConditionalFormattingColorScaleRule()
The thresholds and colours for it will be created, but will be
empty and require configuring with
HSSFConditionalFormattingRule.getColorScaleFormatting()
then
HSSFColorScaleFormatting.getThresholds()
and
HSSFColorScaleFormatting.getColors()
createConditionalFormattingColorScaleRule
in interface SheetConditionalFormatting
public int addConditionalFormatting(HSSFConditionalFormatting cf)
This method could be used to copy HSSFConditionalFormatting object from one sheet to another. For example:
HSSFConditionalFormatting cf = sheet.getConditionalFormattingAt(index); newSheet.addConditionalFormatting(cf);
cf
- HSSFConditionalFormatting objectpublic int addConditionalFormatting(ConditionalFormatting cf)
SheetConditionalFormatting
This method could be used to copy ConditionalFormatting object from one sheet to another. For example:
ConditionalFormatting cf = sheet.getConditionalFormattingAt(index); newSheet.addConditionalFormatting(cf);
addConditionalFormatting
in interface SheetConditionalFormatting
cf
- the Conditional Formatting to clonepublic int addConditionalFormatting(CellRangeAddress[] regions, HSSFConditionalFormattingRule[] cfRules)
regions
- - list of rectangular regions to apply conditional formatting rulescfRules
- - set of up to three conditional formatting rulespublic int addConditionalFormatting(CellRangeAddress[] regions, ConditionalFormattingRule[] cfRules)
SheetConditionalFormatting
addConditionalFormatting
in interface SheetConditionalFormatting
regions
- - list of rectangular regions to apply conditional formatting rulescfRules
- - set of up to conditional formatting rules (max 3 for Excel pre-2007)public int addConditionalFormatting(CellRangeAddress[] regions, HSSFConditionalFormattingRule rule1)
public int addConditionalFormatting(CellRangeAddress[] regions, ConditionalFormattingRule rule1)
SheetConditionalFormatting
addConditionalFormatting
in interface SheetConditionalFormatting
regions
- - list of rectangular regions to apply conditional formatting rulesrule1
- - the rule to applypublic int addConditionalFormatting(CellRangeAddress[] regions, HSSFConditionalFormattingRule rule1, HSSFConditionalFormattingRule rule2)
public int addConditionalFormatting(CellRangeAddress[] regions, ConditionalFormattingRule rule1, ConditionalFormattingRule rule2)
SheetConditionalFormatting
addConditionalFormatting
in interface SheetConditionalFormatting
regions
- - list of rectangular regions to apply conditional formatting rulesrule1
- - the first rulerule2
- - the second rulepublic HSSFConditionalFormatting getConditionalFormattingAt(int index)
getConditionalFormattingAt
in interface SheetConditionalFormatting
index
- of the Conditional Formatting object to fetchpublic int getNumConditionalFormattings()
getNumConditionalFormattings
in interface SheetConditionalFormatting
public void removeConditionalFormatting(int index)
removeConditionalFormatting
in interface SheetConditionalFormatting
index
- of a Conditional Formatting object to removeCopyright 2022 The Apache Software Foundation or its licensors, as applicable.