Wiki Markup |
---|
{description} {excerpt}Returns the [Condition|Condition] object at the specified 0\-based index. {excerpt} {signature:C#} public Condition this[int index] { get; } {signature}{signature: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#} 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:vb.net|title=vb.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} |
Page History
Overview
Content Tools