FormatCondition

FormatCondition class

Represents conditional formatting condition.

Methods

NameDescription
getAboveAverage()Get the conditional formatting’s “AboveAverage” instance. The default instance’s rule highlights cells that are above th
getColorScale()Get the conditional formatting’s “ColorScale” instance. The default instance is a “green-yellow-red” 3ColorScale . Valid
getDataBar()Get the conditional formatting’s “DataBar” instance. The default instance’s color is blue. Valid only for type is DataBa
getFormula1()Gets and sets the value or expression associated with conditional formatting. Please add all areas before setting formul
getFormula1(isR1C1, isLocal)Gets the value or expression associated with this format condition.
getFormula1(isR1C1, isLocal, row, column)Gets the value or expression of the conditional formatting of the cell. The given cell must be contained by this conditi
getFormula1(row, column)Gets the formula of the conditional formatting of the cell.
getFormula2()Gets and sets the value or expression associated with conditional formatting. Please add all areas before setting formul
getFormula2(isR1C1, isLocal)Gets the value or expression associated with this format condition.
getFormula2(isR1C1, isLocal, row, column)Gets the value or expression of the conditional formatting of the cell. The given cell must be contained by this conditi
getFormula2(row, column)Gets the formula of the conditional formatting of the cell.
getIconSet()Get the conditional formatting’s “IconSet” instance. The default instance’s IconSetType is TrafficLights31. Valid only f
getOperator()Gets and sets the conditional format operator type. The value of the property is OperatorType integer constant.OperatorT
getPriority()The priority of this conditional formatting rule. This value is used to determine which format should be evaluated and r
getStopIfTrue()True, no rules with lower priority may be applied over this rule, when this rule evaluates to true. Only applies for Exc
getStyle()Gets or setts style of conditional formatted cell ranges.
getText()The text value in a “text contains” conditional formatting rule. Valid only for type = containsText, notContainsText, be
getTimePeriod()The applicable time period in a “date occurring…” conditional formatting rule. Valid only for type = timePeriod. The def
getTop10()Get the conditional formatting’s “Top10” instance. The default instance’s rule highlights cells whose values fall in the
getType()Gets and sets whether the conditional format Type. The value of the property is FormatConditionType integer constant.For
setFormula1()Gets and sets the value or expression associated with conditional formatting. Please add all areas before setting formul
setFormula1(formula, isR1C1, isLocal)Sets the value or expression associated with this format condition.
setFormula2()Gets and sets the value or expression associated with conditional formatting. Please add all areas before setting formul
setFormula2(formula, isR1C1, isLocal)Sets the value or expression associated with this format condition.
setFormulas(formula1, formula2, isR1C1, isLocal)Sets the value or expression associated with this format condition.
setOperator()Gets and sets the conditional format operator type. The value of the property is OperatorType integer constant.OperatorT
setPriority()The priority of this conditional formatting rule. This value is used to determine which format should be evaluated and r
setStopIfTrue()True, no rules with lower priority may be applied over this rule, when this rule evaluates to true. Only applies for Exc
setStyle()Gets or setts style of conditional formatted cell ranges.
setText()The text value in a “text contains” conditional formatting rule. Valid only for type = containsText, notContainsText, be
setTimePeriod()The applicable time period in a “date occurring…” conditional formatting rule. Valid only for type = timePeriod. The def
setType()Gets and sets whether the conditional format Type. The value of the property is FormatConditionType integer constant.For

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: AboveAverage — AboveAverage

getColorScale()

Get the conditional formatting’s “ColorScale” instance. The default instance is a “green-yellow-red” 3ColorScale . Valid only for type = ColorScale.

Returns: ColorScale — ColorScale

getDataBar()

Get the conditional formatting’s “DataBar” instance. The default instance’s color is blue. Valid only for type is DataBar.

Returns: DataBar — DataBar

getFormula1()

Gets and sets the value or expression associated with conditional formatting. Please add all areas before setting formula. For setting formula for this condition, if the input value starts with ‘=’, then it will be taken as formula. Otherwise it will be taken as plain value(text, number, bool). For text value that starts with ‘=’, user may input it as formula in format: “="=…”".

getFormula1(isR1C1, isLocal)

Gets the value or expression associated with this format condition.

ParameterTypeDescription
isR1C1booleanWhether the formula needs to be formatted as R1C1.
isLocalbooleanWhether the formula needs to be formatted by locale.

Returns: String — String The value or expression associated with this format condition.

getFormula1(isR1C1, isLocal, row, column)

Gets the value or expression of the conditional formatting of the cell. The given cell must be contained by this conditional formatting, otherwise null will be returned.

ParameterTypeDescription
isR1C1booleanWhether the formula needs to be formatted as R1C1.
isLocalbooleanWhether the formula needs to be formatted by locale.
rowNumberThe row index.
columnNumberThe column index.

Returns: String — String The value or expression associated with the conditional formatting of the cell.

getFormula1(row, column)

Gets the formula of the conditional formatting of the cell.

ParameterTypeDescription
rowNumberThe row index.
columnNumberThe column index.

Returns: String — String The formula.

getFormula2()

Gets and sets the value or expression associated with conditional formatting. Please add all areas before setting formula. For setting formula for this condition, if the input value starts with ‘=’, then it will be taken as formula. Otherwise it will be taken as plain value(text, number, bool). For text value that starts with ‘=’, user may input it as formula in format: “="=…”".

getFormula2(isR1C1, isLocal)

Gets the value or expression associated with this format condition.

ParameterTypeDescription
isR1C1booleanWhether the formula needs to be formatted as R1C1.
isLocalbooleanWhether the formula needs to be formatted by locale.

Returns: String — String The value or expression associated with this format condition.

getFormula2(isR1C1, isLocal, row, column)

Gets the value or expression of the conditional formatting of the cell. The given cell must be contained by this conditional formatting, otherwise null will be returned.

ParameterTypeDescription
isR1C1booleanWhether the formula needs to be formatted as R1C1.
isLocalbooleanWhether the formula needs to be formatted by locale.
rowNumberThe row index.
columnNumberThe column index.

Returns: String — String The value or expression associated with the conditional formatting of the cell.

getFormula2(row, column)

Gets the formula of the conditional formatting of the cell.

ParameterTypeDescription
rowNumberThe row index.
columnNumberThe column index.

Returns: String — String The formula.

getIconSet()

Get the conditional formatting’s “IconSet” instance. The default instance’s IconSetType is TrafficLights31. Valid only for type = IconSet.

Returns: IconSet — IconSet

getOperator()

Gets and sets the conditional format operator type. The value of the property is OperatorType integer constant.OperatorType

getPriority()

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.

getStopIfTrue()

True, no rules with lower priority may be applied over this rule, when this rule evaluates to true. Only applies for Excel 2007;

getStyle()

Gets or setts style of conditional formatted cell ranges.

getText()

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()

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.

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 is Top10.

Returns: Top10 — Top10

getType()

Gets and sets whether the conditional format Type. The value of the property is FormatConditionType integer constant.FormatConditionType

setFormula1()

Gets and sets the value or expression associated with conditional formatting. Please add all areas before setting formula. For setting formula for this condition, if the input value starts with ‘=’, then it will be taken as formula. Otherwise it will be taken as plain value(text, number, bool). For text value that starts with ‘=’, user may input it as formula in format: “="=…”".

setFormula1(formula, isR1C1, isLocal)

Sets the value or expression associated with this format condition.

ParameterTypeDescription
formulaStringThe value or expression associated with this format condition. If the input value starts with ‘=’, then it will be taken as formula. Otherwise it will be taken as plain value(text, number, bool). For text value that starts with ‘=’, user may input it as formula in format: “="=…”".
isR1C1booleanWhether the formula is R1C1 formula.
isLocalbooleanWhether the formula is locale formatted.

setFormula2()

Gets and sets the value or expression associated with conditional formatting. Please add all areas before setting formula. For setting formula for this condition, if the input value starts with ‘=’, then it will be taken as formula. Otherwise it will be taken as plain value(text, number, bool). For text value that starts with ‘=’, user may input it as formula in format: “="=…”".

setFormula2(formula, isR1C1, isLocal)

Sets the value or expression associated with this format condition.

ParameterTypeDescription
formulaStringThe value or expression associated with this format condition. If the input value starts with ‘=’, then it will be taken as formula. Otherwise it will be taken as plain value(text, number, bool). For text value that starts with ‘=’, user may input it as formula in format: “="=…”".
isR1C1booleanWhether the formula is R1C1 formula.
isLocalbooleanWhether the formula is locale formatted.

setFormulas(formula1, formula2, isR1C1, isLocal)

Sets the value or expression associated with this format condition.

ParameterTypeDescription
formula1StringThe value or expression associated with this format condition. If the input value starts with ‘=’, then it will be taken as formula. Otherwise it will be taken as plain value(text, number, bool). For text value that starts with ‘=’, user may input it as formula in format: “="=…”".
formula2StringThe value or expression associated with this format condition. The input format is same with formula1
isR1C1booleanWhether the formula is R1C1 formula.
isLocalbooleanWhether the formula is locale formatted.

setOperator()

Gets and sets the conditional format operator type. The value of the property is OperatorType integer constant.OperatorType

setPriority()

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.

setStopIfTrue()

True, no rules with lower priority may be applied over this rule, when this rule evaluates to true. Only applies for Excel 2007;

setStyle()

Gets or setts style of conditional formatted cell ranges.

setText()

The text value in a “text contains” conditional formatting rule. Valid only for type = containsText, notContainsText, beginsWith and endsWith. The default value is null.

setTimePeriod()

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.

setType()

Gets and sets whether the conditional format Type. The value of the property is FormatConditionType integer constant.FormatConditionType