# GrapeCity.Spreadsheet.IFormatConditions.Add

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_Spreadsheet_IFormatConditions_Add_" data-uid="GrapeCity.Spreadsheet.IFormatConditions.Add*">Add Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_Spreadsheet_IFormatConditions_Add_" data-uid="GrapeCity.Spreadsheet.IFormatConditions.Add*"></a>
<h4 id="GrapeCity_Spreadsheet_IFormatConditions_Add_GrapeCity_Spreadsheet_FormatConditionType_GrapeCity_Spreadsheet_FormatConditionOperator_System_String_System_String_GrapeCity_Spreadsheet_ContainsOperator_GrapeCity_Spreadsheet_TimePeriods_" data-uid="GrapeCity.Spreadsheet.IFormatConditions.Add(GrapeCity.Spreadsheet.FormatConditionType,GrapeCity.Spreadsheet.FormatConditionOperator,System.String,System.String,GrapeCity.Spreadsheet.ContainsOperator,GrapeCity.Spreadsheet.TimePeriods)">Add(FormatConditionType, FormatConditionOperator, string, string, ContainsOperator, TimePeriods)</h4>
<div class="markdown level1 summary"><p>Adds a new conditional format.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">IFormatCondition Add(FormatConditionType type, FormatConditionOperator @operator = FormatConditionOperator.Equal, string formula1 = null, string formula2 = null, ContainsOperator textOperator = ContainsOperator.Contains, TimePeriods dateOperator = TimePeriods.Today)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Function Add(type As FormatConditionType, Optional [operator] As FormatConditionOperator = FormatConditionOperator.Equal, Optional formula1 As String = Nothing, Optional formula2 As String = Nothing, Optional textOperator As ContainsOperator = ContainsOperator.Contains, Optional dateOperator As TimePeriods = TimePeriods.Today) As IFormatCondition</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="GrapeCity.Spreadsheet.FormatConditionType.html">FormatConditionType</a></td>
      <td><span class="parametername">type</span></td>
      <td><p>Specifies whether the conditional format is based on a cell value or an expression.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="GrapeCity.Spreadsheet.FormatConditionOperator.html">FormatConditionOperator</a></td>
      <td><span class="parametername">operator</span></td>
      <td><p>The conditional format operator. If <code class="paramref">type</code> is <a class="xref" href="GrapeCity.Spreadsheet.FormatConditionType.html#GrapeCity_Spreadsheet_FormatConditionType_TextString">TextString</a> or <a class="xref" href="GrapeCity.Spreadsheet.FormatConditionType.html#GrapeCity_Spreadsheet_FormatConditionType_Expression">Expression</a>, it'll be ignored.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">formula1</span></td>
      <td><p>The value or expression associated with the conditional format. Can be a constant value, a string value, a cell reference, or a formula.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">formula2</span></td>
      <td><p>The value or expression associated with the second part of the conditional format when Operator is xlBetween or xlNotBetween (otherwise, this argument is ignored). Can be a constant value, a string value, a cell reference, or a formula.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="GrapeCity.Spreadsheet.ContainsOperator.html">ContainsOperator</a></td>
      <td><span class="parametername">textOperator</span></td>
      <td><p>The conditional format text operator. If <code class="paramref">type</code> isn't <a class="xref" href="GrapeCity.Spreadsheet.FormatConditionType.html#GrapeCity_Spreadsheet_FormatConditionType_TextString">TextString</a>, it'll be ignored.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="GrapeCity.Spreadsheet.TimePeriods.html">TimePeriods</a></td>
      <td><span class="parametername">dateOperator</span></td>
      <td><p>The date operator used in the format condition.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="GrapeCity.Spreadsheet.IFormatCondition.html">IFormatCondition</a></td>
      <td><p>A <a class="xref" href="GrapeCity.Spreadsheet.IFormatCondition.html">IFormatCondition</a> object that represents the new conditional format.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="GrapeCity_Spreadsheet_IFormatConditions_Add_GrapeCity_Spreadsheet_FormatConditionType_GrapeCity_Spreadsheet_FormatConditionOperator_System_String_System_String_GrapeCity_Spreadsheet_ContainsOperator_GrapeCity_Spreadsheet_TimePeriods__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>Because <code class="paramref">formula1</code> and <code class="paramref">formula2</code> are also used for primitive value, the formula must start with &quot;=&quot;.</p>
</div>


<a id="GrapeCity_Spreadsheet_IFormatConditions_Add_" data-uid="GrapeCity.Spreadsheet.IFormatConditions.Add*"></a>
<h4 id="GrapeCity_Spreadsheet_IFormatConditions_Add_GrapeCity_Spreadsheet_ContainsOperator_System_String_" data-uid="GrapeCity.Spreadsheet.IFormatConditions.Add(GrapeCity.Spreadsheet.ContainsOperator,System.String)">Add(ContainsOperator, string)</h4>
<div class="markdown level1 summary"><p>Adds a new conditional format.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">IFormatCondition Add(ContainsOperator @operator, string text)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Function Add([operator] As ContainsOperator, text As String) As IFormatCondition</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="GrapeCity.Spreadsheet.ContainsOperator.html">ContainsOperator</a></td>
      <td><span class="parametername">operator</span></td>
      <td><p>The conditional format text operator.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">text</span></td>
      <td><p>The text associated with the conditional format.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="GrapeCity.Spreadsheet.IFormatCondition.html">IFormatCondition</a></td>
      <td><p>A <a class="xref" href="GrapeCity.Spreadsheet.IFormatCondition.html">IFormatCondition</a> object that represents the new conditional format.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Spreadsheet_IFormatConditions_Add_" data-uid="GrapeCity.Spreadsheet.IFormatConditions.Add*"></a>
<h4 id="GrapeCity_Spreadsheet_IFormatConditions_Add_GrapeCity_Spreadsheet_TimePeriods_" data-uid="GrapeCity.Spreadsheet.IFormatConditions.Add(GrapeCity.Spreadsheet.TimePeriods)">Add(TimePeriods)</h4>
<div class="markdown level1 summary"><p>Adds a new conditional format.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">IFormatCondition Add(TimePeriods dateOperator)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Function Add(dateOperator As TimePeriods) As IFormatCondition</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="GrapeCity.Spreadsheet.TimePeriods.html">TimePeriods</a></td>
      <td><span class="parametername">dateOperator</span></td>
      <td><p>The date operator used in the format condition.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="GrapeCity.Spreadsheet.IFormatCondition.html">IFormatCondition</a></td>
      <td><p>A <a class="xref" href="GrapeCity.Spreadsheet.IFormatCondition.html">IFormatCondition</a> object that represents the new conditional format.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
