public class XSSFSheetConditionalFormatting extends java.lang.Object implements SheetConditionalFormatting
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
CF_EXT_2009_NS_X14
Office 2010 Conditional Formatting extensions namespace
|
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(ConditionalFormatting cf)
Adds a copy of HSSFConditionalFormatting object to the sheet
|
XSSFConditionalFormattingRule |
createConditionalFormattingColorScaleRule()
Create a Color Scale / Color Gradient conditional formatting rule.
|
XSSFConditionalFormattingRule |
createConditionalFormattingRule(byte comparisonOperation,
java.lang.String formula)
Create a conditional formatting rule that compares a cell value
to a formula calculated result, using an operator *
|
XSSFConditionalFormattingRule |
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
|
XSSFConditionalFormattingRule |
createConditionalFormattingRule(ExtendedColor color)
Create a Databar conditional formatting rule.
|
XSSFConditionalFormattingRule |
createConditionalFormattingRule(IconMultiStateFormatting.IconSet iconSet)
A factory method allowing the creation of conditional formatting
rules using an Icon Set / Multi-State formatting.
|
XSSFConditionalFormattingRule |
createConditionalFormattingRule(java.lang.String formula)
A factory method allowing to create a conditional formatting rule with a formula.
|
XSSFConditionalFormattingRule |
createConditionalFormattingRule(XSSFColor color)
Create a Databar conditional formatting rule.
|
XSSFConditionalFormatting |
getConditionalFormattingAt(int index)
gets Conditional Formatting object at a particular index
|
int |
getNumConditionalFormattings() |
void |
removeConditionalFormatting(int index)
removes a Conditional Formatting object by index
|
protected static final java.lang.String CF_EXT_2009_NS_X14
public XSSFConditionalFormattingRule 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
ComparisonOperator.BETWEEN
) and
ComparisonOperator.NOT_BETWEEN
operations)public XSSFConditionalFormattingRule createConditionalFormattingRule(byte comparisonOperation, java.lang.String formula)
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_BETWEENformula
- the formula to determine if the conditional formatting is appliedpublic XSSFConditionalFormattingRule createConditionalFormattingRule(java.lang.String formula)
createConditionalFormattingRule
in interface SheetConditionalFormatting
formula
- - formula for the valued, compared with the cellpublic XSSFConditionalFormattingRule createConditionalFormattingRule(XSSFColor color)
The thresholds and colour for it will be created, but will be
empty and require configuring with
XSSFConditionalFormattingRule.getDataBarFormatting()
then
XSSFDataBarFormatting.getMinThreshold()
and
XSSFDataBarFormatting.getMaxThreshold()
public XSSFConditionalFormattingRule 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 XSSFConditionalFormattingRule createConditionalFormattingRule(IconMultiStateFormatting.IconSet iconSet)
XSSFConditionalFormattingRule.getMultiStateFormatting()
then
XSSFIconMultiStateFormatting.getThresholds()
createConditionalFormattingRule
in interface SheetConditionalFormatting
public XSSFConditionalFormattingRule createConditionalFormattingColorScaleRule()
The thresholds and colours for it will be created, but will be
empty and require configuring with
XSSFConditionalFormattingRule.getColorScaleFormatting()
then
XSSFColorScaleFormatting.getThresholds()
and
XSSFColorScaleFormatting.getColors()
createConditionalFormattingColorScaleRule
in interface SheetConditionalFormatting
public 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, 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, 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 int addConditionalFormatting(ConditionalFormatting 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);
addConditionalFormatting
in interface SheetConditionalFormatting
cf
- HSSFConditionalFormatting objectpublic XSSFConditionalFormatting 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.