Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Description

Excerpt

Returns the Condition object at the specified 0-based index.

Signature
C#
C#
 public Condition this[int index] { get; }
{signature}{signature:
}
Signature
vb.net
vb.net
Public Default ReadOnly Property Item(ByVal index As Integer) As Condition
{signature}
{parameters}
{param:index}The 0\-based index of the {{Condition}} object.{param}
{remarks}
The index determines the order in which conditions will be evaluated.  A [ConditionalFormat|ConditionalFormat] may contain up to three {{Condition}} objects.
{remarks}
{example}{code:csharp|title=C#}
Parameters
Param
index
index

The 0-based index of the Condition object.

Remarks

The index determines the order in which conditions will be evaluated. A ConditionalFormat may contain up to three Condition objects.

Example
Code Block
csharp
csharp
titleC#


          ExcelApplication xla = new ExcelApplication();
          Workbook wb = xla.Create();

          //--- Create a range of the cells that will have the conditional formatting.
          Range vRange = wb.Worksheets[0].CreateRange("$B$2:$F$10");
          Area vArea = vRange.Areas[0];

          //--- Get the conditional format for the first cell within this range.
          ConditionalFormat vCndFmt = vArea[0,0].ConditionalFormat;

          //--- Modify the first condition.
          Condition vCondition = vCondFmt.Condition[0];
          vCondition.ChangeConditionType(Condition.Comparison.CellValueLessThan, "=100");

          vRange.SetConditionalFormat(vCondFmt);
        
{code} {code:
Code Block
vb.net
|title=
vb.net
titlevb.net
}


          Dim xla As New ExcelApplication()
          Dim wb As Workbook = xla.Create()

          '--- Create a range of the cells that will have the conditional formatting.
          Dim rng As Range = wb.Worksheets(0).CreateRange("$B$2:$F$10")
          Dim ar As Area = rng.Areas(0)

          '--- Get the conditional format for the first cell within this range.
          Dim CondFmt As ConditionalFormat = ar(0,0).ConditionalFormat

          '--- Modify the first condition.
          Dim cond As Condition = CondFmt.Condition(0)
          cond.ChangeConditionType(Condition.Comparison.CellValueLessThan, "=100")

          rng.SetConditionalFormat(vCndFmt)
        
{code} {example}