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

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

Signature
C#
C#
 public void ChangeCondition(Comparison comparisonType, System.String formula)
{signature}{signature:
}
Signature
vb.net
vb.net
Public Sub ChangeCondition(ByVal comparisonType As Comparison, ByVal formula As String)
{signature}
{parameters}
{param:comparisonType}The type of comparison Excel will use when comparing a cell value to the result of {{formula}}. The comparison type must require only one formula and may be set to one of the following values: [Comparison.FormulaEvaluates|Condition.Comparison#FormulaEvaluates], {{Comparison.CellValueLessThan}}, [Comparison.CellValueGreaterThan|Condition.Comparison#CellValueGreaterThan], [Comparison.CellValueLessThanOrEqualTo|Condition.Comparison#CellValueLessThanOrEqualTo], [Comparison.CellValueGreaterThanOrEqualTo|Condition.Comparison#CellValueGreaterThanOrEqualTo], [Comparison.CellValueEqualTo|Condition.Comparison#CellValueEqualTo], or [Comparison.CellValueNotEqualTo|Condition.Comparison#CellValueNotEqualTo].{param}
{param:formula}The result of this formula will be compared to each cell value in the set of cells associated with the conditional format.{param}
{example}{code:csharp|title=C#}
Parameters
Param
comparisonType
comparisonType

The type of comparison Excel will use when comparing a cell value to the result of formula. The comparison type must require only one formula and may be set to one of the following values: Comparison.FormulaEvaluates, Comparison.CellValueLessThan, Comparison.CellValueGreaterThan, Comparison.CellValueLessThanOrEqualTo, Comparison.CellValueGreaterThanOrEqualTo, Comparison.CellValueEqualTo, or Comparison.CellValueNotEqualTo.

Param
formula
formula

The result of this formula will be compared to each cell value in the set of cells associated with the conditional format.

Example
Code Block
csharp
csharp
titleC#


          ExcelApplication xla = new ExcelApplication();
          Workbook wb = xla.Create();
          ConditionalFormat condFmt = wb.CreateConditionalFormat();
          Condition cond =
               condFmt.CreateCondition(
               Condition.Comparison.CellValueBetween,
               "=100",
               "=150");
          cond.ChangeCondition(
               Condition.Comparison.CellValueGreaterThan, "=100");
        
{code} {code:
Code Block
vb.net
|title=
vb.net
titlevb.net
}


          Dim xla As New ExcelApplication()
          Dim wb As Workbook = xla.Create()
          Dim condFmt As ConditionalFormat = wb.CreateConditionalFormat()
          Dim cond As Condition = _
               condFmt.CreateCondition( _
               Condition.Comparison.CellValueBetween, _
               "=100", _
               "=150")
          cond.ChangeCondition( _
               Condition.Comparison.CellValueGreaterThan, "=100")
        
{code} {example}