public final class HSSFConditionalFormatting extends java.lang.Object implements ConditionalFormatting
HSSFConditionalFormatting cf = sheet.getConditionalFormattingAt(index); newSheet.addConditionalFormatting(cf);
HSSFSheet.getSheetConditionalFormatting()
to get access to an instance of this class.
To create a new Conditional Formatting set use the following approach:
// Define a Conditional Formatting rule, which triggers formatting // when cell's value is greater or equal than 100.0 and // applies patternFormatting defined below. HSSFConditionalFormattingRule rule = sheet.createConditionalFormattingRule( ComparisonOperator.GE, "100.0", // 1st formula null // 2nd formula is not used for comparison operator GE ); // Create pattern with red background HSSFPatternFormatting patternFmt = rule.cretePatternFormatting(); patternFormatting.setFillBackgroundColor(HSSFColor.RED.index); // Define a region containing first column Region [] regions = { new Region(1,(short)1,-1,(short)1) }; // Apply Conditional Formatting rule defined above to the regions sheet.addConditionalFormatting(regions, rule);
Modifier and Type | Method and Description |
---|---|
void |
addRule(ConditionalFormattingRule cfRule)
Add a Conditional Formatting rule.
|
void |
addRule(HSSFConditionalFormattingRule cfRule)
add a Conditional Formatting rule.
|
CellRangeAddress[] |
getFormattingRanges() |
Region[] |
getFormattingRegions()
Deprecated.
(Aug-2008) use
getFormattingRanges() |
int |
getNumberOfRules() |
HSSFConditionalFormattingRule |
getRule(int idx) |
void |
setRule(int idx,
ConditionalFormattingRule cfRule)
Replaces an existing Conditional Formatting rule at position idx.
|
void |
setRule(int idx,
HSSFConditionalFormattingRule cfRule)
Replaces an existing Conditional Formatting rule at position idx.
|
java.lang.String |
toString() |
public Region[] getFormattingRegions()
getFormattingRanges()
public CellRangeAddress[] getFormattingRanges()
getFormattingRanges
in interface ConditionalFormatting
null
public void setRule(int idx, HSSFConditionalFormattingRule cfRule)
idx
- position of the rule. Should be between 0 and 2.cfRule
- - Conditional Formatting rulepublic void setRule(int idx, ConditionalFormattingRule cfRule)
ConditionalFormatting
setRule
in interface ConditionalFormatting
idx
- position of the rule. Should be between 0 and 2.cfRule
- - Conditional Formatting rulepublic void addRule(HSSFConditionalFormattingRule cfRule)
cfRule
- - Conditional Formatting rulepublic void addRule(ConditionalFormattingRule cfRule)
ConditionalFormatting
addRule
in interface ConditionalFormatting
cfRule
- - Conditional Formatting rulepublic HSSFConditionalFormattingRule getRule(int idx)
getRule
in interface ConditionalFormatting
public int getNumberOfRules()
getNumberOfRules
in interface ConditionalFormatting
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2005-2010 Potix Corporation. All Rights Reserved.