Message-ID: <299104540.8989.1711670894292.JavaMail.web05$@web05> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_8988_1350580190.1711670894292" ------=_Part_8988_1350580190.1711670894292 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html Condition

Condition

Description

=20

A Condition object represents a = condition within a ConditionalF= ormat, a format that Excel will apply to a cell or group of cells if a = specified condition is met.

=20
C#
=20
 public sealed class Condition
=20
=20
vb.net
=20
Public NotInheritable Class Condition
=20
=20

Remarks

=20

A Condition= alFormat object contains up to three Condition objects and= a Range object repres= enting the set of cells on which the conditions will be tested.

=20

To create a Condition object, call one of the Conditi= onalFormat object's CreateCondition methods.

=20

Examples

=20
C#
=20
ExcelApplication xla =3D new ExcelApplication();
Workbook wb =3D xla.Create();
Range rng =3D wb.Worksheets[0].CreateRange("$B$2:$F$10");
ConditionalFormat condFmt =3D wb.CreateConditionalFormat();
Condition cond =3D
     condFmt.CreateCondition(
     Condition.Comparison.CellValueGreaterThan,=20
     "=3D100");
Font fnt =3D cond.Style.Font;
fnt.Bold =3D true;
fnt.Color =3D wb.Palette.GetClosestColor(100, 100, 255);
rng.SetConditionalFormat(condFmt);
=20
=20
vb.net
=20
Dim xla As New ExcelApplication()
Dim wb As Workbook =3D xla.Create()
Dim rng As Range =3D wb.Worksheets(0).CreateRange("$B$2:$F$10")
Dim condFmt As ConditionalFormat =3D wb.CreateConditionalFormat()
Dim cond As Condition =3D _
     condFmt.CreateCondition( _
     Condition.Comparison.CellValueGreaterThan, _
     "=3D100")
Dim fnt As Font =3D cond.Style.Font
fnt.Bold =3D true
fnt.Color =3D wb.Palette.GetClosestColor(100, 100, 255)
rng.SetConditionalFormat(condFmt)
=20
=20

Properties

=20
=20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20

Name

Description

ComparisonType

Returns the = Condition's Condition.Co= mparison value, which determines whether each cell value will be compar= ed with one or two other values, or if a formula will be evaluated for each= cell.

= Formula1

If the comparison is between a cell value and tw= o values, this is the minimum value; otherwise this is is the formula to be= evaluated for the condition.

= Formula2

If the value of Condition.ComparisonType is a comparison between a c= ell value and two values (e.g., Condition.Comparison.CellValueBet= ween), Formula2
= sets or returns a formula whose result will be the maximum comparison value= .

Sty= le

Sets or returns the Style that will be set on conditionally formatted cells w= hen the current Condition is met.=20
=20

Methods

=20
=20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 = =20 =20 =20

Name

Description

ApplyStyle(Style)

Applies the specified Style to the Condit= ion's current Style. =20

ChangeCondition(Condition.Comparison, String)

Resets the current Condition's Compa= rison type and formula. The method takes one formulas, and therefore mu= st take a Comparison that requires one formulas, such as Comparison.CellValueLessThan.

ChangeCondition(Condition.Comparison, String, String)

Resets the current Condition's Compa= rison type and minimum and maximum formulas. The method takes two formu= las, and therefore must take a Comparison that requires two fo= rmulas, such as Comparison.CellValueBetween.
=20

Nested Classes

=20
=20 =20 =20 =20 =20 =20 =20 =20 =20

Name

Description

Comparison

The value of Condition.Comparison determines whether the value of a cond= itionally formatted cell will be compared with one or two other values, or = if a formula will be evaluated for each cell.
------=_Part_8988_1350580190.1711670894292--