com.aspose.cells
Class FormatCondition

java.lang.Object
    extended by com.aspose.cells.FormatCondition

public abstract class FormatCondition 
extends java.lang.Object

Represents conditional formatting condition.

Example:

//Instantiating a Workbook object
Workbook workbook = new Workbook();
Worksheet sheet = workbook.getWorksheets().get(0);

//Adds an empty conditional formatting
int index = sheet.getConditionalFormattings().add();
FormatConditionCollection fcs = sheet.getConditionalFormattings().get(index);

//Sets the conditional format range.
CellArea ca = new CellArea();
ca.StartRow = 0;
ca.EndRow = 0;
ca.StartColumn = 0;
ca.EndColumn = 0;
fcs.addArea(ca);

ca = new CellArea();
ca.StartRow = 1;
ca.EndRow = 1;
ca.StartColumn = 1;
ca.EndColumn = 1;
fcs.addArea(ca);

//Adds condition.
int conditionIndex = fcs.addCondition(FormatConditionType.CELL_VALUE, OperatorType.BETWEEN, "=A2", "100");

//Adds condition.
int conditionIndex2 = fcs.addCondition(FormatConditionType.CELL_VALUE, OperatorType.BETWEEN, "50", "100");

//Sets the background color.
FormatCondition fc = fcs.get(conditionIndex);
fc.getStyle().setBackgroundColor(Color.getRed());

//Saving the Excel file
workbook.save("C:\\output.xls");

Property Getters/Setters Summary
abstract AboveAveragegetAboveAverage()
           Get the conditional formatting's "AboveAverage" instance. The default instance's rule highlights cells that are above the average for all values in the range. Valid only for type = AboveAverage.
abstract ColorScalegetColorScale()
           Get the conditional formatting's "ColorScale" instance. The default instance is a "green-yellow-red" 3ColorScale . Valid only for type = ColorScale.
abstract DataBargetDataBar()
           Get the conditional formatting's "DataBar" instance. The default instance's color is blue. Valid only for type = DataBar.
abstract java.lang.StringgetFormula1()
abstract voidsetFormula1(java.lang.String value)
           Gets and sets the value or expression associated with conditional formatting.
abstract java.lang.StringgetFormula2()
abstract voidsetFormula2(java.lang.String value)
           Gets and sets the value or expression associated with conditional formatting.
abstract IconSetgetIconSet()
           Get the conditional formatting's "IconSet" instance. The default instance's IconSetType is TrafficLights31. Valid only for type = IconSet.
abstract intgetOperator()
abstract voidsetOperator(int value)
           Gets and sets the conditional format operator type. The value of the property is OperatorType integer constant.
abstract intgetPriority()
abstract voidsetPriority(int value)
           The priority of this conditional formatting rule. This value is used to determine which format should be evaluated and rendered. Lower numeric values are higher priority than higher numeric values, where '1' is the highest priority.
abstract booleangetStopIfTrue()
abstract voidsetStopIfTrue(boolean value)
           True, no rules with lower priority may be applied over this rule, when this rule evaluates to true. Only applies for Excel 2007;
abstract StylegetStyle()
abstract voidsetStyle(Style value)
           Gets or setts style of conditional formatted cell ranges.
abstract java.lang.StringgetText()
abstract voidsetText(java.lang.String value)
           The text value in a "text contains" conditional formatting rule. Valid only for type = containsText, notContainsText, beginsWith and endsWith. The default value is null.
abstract intgetTimePeriod()
abstract voidsetTimePeriod(int value)
           The applicable time period in a "date occurring¡­" conditional formatting rule. Valid only for type = timePeriod. The default value is TimePeriodType.Today. The value of the property is TimePeriodType integer constant.
abstract Top10getTop10()
           Get the conditional formatting's "Top10" instance. The default instance's rule highlights cells whose values fall in the top 10 bracket. Valid only for type = Top10.
abstract intgetType()
abstract voidsetType(int value)
           Gets and sets whether the conditional format Type. The value of the property is FormatConditionType integer constant.
 
Method Summary
abstract java.lang.StringgetFormula1(int row, int column)
           Gets the formula of the conditional formatting of the cell.
abstract java.lang.StringgetFormula2(int row, int column)
           Gets the formula of the conditional formatting of the cell.
 

Property Getters/Setters Detail

getFormula1/setFormula1

public abstract java.lang.String getFormula1() / public abstract void setFormula1(java.lang.String value)
Gets and sets the value or expression associated with conditional formatting. Please add all areas before setting formula.

getFormula2/setFormula2

public abstract java.lang.String getFormula2() / public abstract void setFormula2(java.lang.String value)
Gets and sets the value or expression associated with conditional formatting. Please add all areas before setting formula.

getOperator/setOperator

public abstract int getOperator() / public abstract void setOperator(int value)
Gets and sets the conditional format operator type. The value of the property is OperatorType integer constant.OperatorType

getStopIfTrue/setStopIfTrue

public abstract boolean getStopIfTrue() / public abstract void setStopIfTrue(boolean value)
True, no rules with lower priority may be applied over this rule, when this rule evaluates to true. Only applies for Excel 2007;

getPriority/setPriority

public abstract int getPriority() / public abstract void setPriority(int value)
The priority of this conditional formatting rule. This value is used to determine which format should be evaluated and rendered. Lower numeric values are higher priority than higher numeric values, where '1' is the highest priority.

getStyle/setStyle

public abstract Style getStyle() / public abstract void setStyle(Style value)
Gets or setts style of conditional formatted cell ranges.

getType/setType

public abstract int getType() / public abstract void setType(int value)
Gets and sets whether the conditional format Type. The value of the property is FormatConditionType integer constant.FormatConditionType

getIconSet

public abstract IconSet getIconSet()
Get the conditional formatting's "IconSet" instance. The default instance's IconSetType is TrafficLights31. Valid only for type = IconSet.
Returns:

getDataBar

public abstract DataBar getDataBar()
Get the conditional formatting's "DataBar" instance. The default instance's color is blue. Valid only for type = DataBar.
Returns:

getColorScale

public abstract ColorScale getColorScale()
Get the conditional formatting's "ColorScale" instance. The default instance is a "green-yellow-red" 3ColorScale . Valid only for type = ColorScale.
Returns:

getTop10

public abstract Top10 getTop10()
Get the conditional formatting's "Top10" instance. The default instance's rule highlights cells whose values fall in the top 10 bracket. Valid only for type = Top10.
Returns:

getAboveAverage

public abstract AboveAverage getAboveAverage()
Get the conditional formatting's "AboveAverage" instance. The default instance's rule highlights cells that are above the average for all values in the range. Valid only for type = AboveAverage.
Returns:

getText/setText

public abstract java.lang.String getText() / public abstract void setText(java.lang.String value)
The text value in a "text contains" conditional formatting rule. Valid only for type = containsText, notContainsText, beginsWith and endsWith. The default value is null.

getTimePeriod/setTimePeriod

public abstract int getTimePeriod() / public abstract void setTimePeriod(int value)
The applicable time period in a "date occurring¡­" conditional formatting rule. Valid only for type = timePeriod. The default value is TimePeriodType.Today. The value of the property is TimePeriodType integer constant.

Method Detail

getFormula1

public abstract java.lang.String getFormula1(int row, int column)
Gets the formula of the conditional formatting of the cell.
Parameters:
row - The row index.
column - The column index.
Returns:
The formula.

getFormula2

public abstract java.lang.String getFormula2(int row, int column)
Gets the formula of the conditional formatting of the cell.
Parameters:
row - The row index.
column - The column index.
Returns:
The formula.

See Also:
          Aspose.Cells Documentation - the home page for the Aspose.Cellss Product Documentation.
          Aspose.Cells Support Forum - our preferred method of support.