public class XSSFSheetConditionalFormatting extends Object implements SheetConditionalFormatting
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 |
createConditionalFormattingRule(byte comparisonOperation,
String formula)
Create a conditional formatting rule that compares a cell value
to a formula calculated result, using an operator *
|
XSSFConditionalFormattingRule |
createConditionalFormattingRule(byte comparisonOperation,
String formula1,
String formula2)
A factory method allowing to create a conditional formatting rule
with a cell comparison operator
TODO - formulas containing cell references are currently not parsed properly
|
XSSFConditionalFormattingRule |
createConditionalFormattingRule(String formula)
A factory method allowing to create a conditional formatting rule with a formula.
|
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
|
public XSSFConditionalFormattingRule createConditionalFormattingRule(byte comparisonOperation, String formula1, String formula2)
createConditionalFormattingRule
in interface SheetConditionalFormatting
comparisonOperation
- - a constant value from
CFRuleRecord.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, String formula)
SheetConditionalFormatting
The type of the created condition is ConditionalFormattingRule.CONDITION_TYPE_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(String formula)
createConditionalFormattingRule
in interface SheetConditionalFormatting
formula
- - formula for the valued, compared with the cellpublic 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 three conditional formatting rulespublic 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 © 2020. All rights reserved.