# GrapeCity.Spreadsheet.IRange.AutoFilter

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_Spreadsheet_IRange_AutoFilter_" data-uid="GrapeCity.Spreadsheet.IRange.AutoFilter*">AutoFilter Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_Spreadsheet_IRange_AutoFilter_" data-uid="GrapeCity.Spreadsheet.IRange.AutoFilter*"></a>
<h4 id="GrapeCity_Spreadsheet_IRange_AutoFilter_System_Boolean_System_Boolean_" data-uid="GrapeCity.Spreadsheet.IRange.AutoFilter(System.Boolean,System.Boolean)">AutoFilter(bool, bool)</h4>
<div class="markdown level1 summary"><p>Creates the automatic filter for current selection if the filter doesn't exist; otherwise, remove the filter.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">bool AutoFilter(bool columnFilter = false, bool initColumns = true)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Function AutoFilter(Optional columnFilter As Boolean = False, Optional initColumns As Boolean = True) As Boolean</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="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">columnFilter</span></td>
      <td><p>A boolean value indicating whether the <a class="xref" href="GrapeCity.Spreadsheet.IAutoFilter.html">IAutoFilter</a> is column filter. The default value is <code>false</code>.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">initColumns</span></td>
      <td><blockquote>
<p>A boolean value indicating whether the <a class="xref" href="GrapeCity.Spreadsheet.IAutoFilter.html">IAutoFilter</a>is init the default column filter when columnFilter is true</p>
</blockquote>
</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="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><p><code>true</code> if has changed; otherwise, <code>false</code>.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Spreadsheet_IRange_AutoFilter_" data-uid="GrapeCity.Spreadsheet.IRange.AutoFilter*"></a>
<h4 id="GrapeCity_Spreadsheet_IRange_AutoFilter_System_Int32_GrapeCity_Spreadsheet_Fill_" data-uid="GrapeCity.Spreadsheet.IRange.AutoFilter(System.Int32,GrapeCity.Spreadsheet.Fill)">AutoFilter(int, Fill)</h4>
<div class="markdown level1 summary"><p>Add the cell fill color filter.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">bool AutoFilter(int columnIndex, Fill fillColor)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Function AutoFilter(columnIndex As Integer, fillColor As Fill) As Boolean</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="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">columnIndex</span></td>
      <td><p>Index of the column.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="GrapeCity.Spreadsheet.Fill.html">Fill</a></td>
      <td><span class="parametername">fillColor</span></td>
      <td><p>Color of the fill.</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="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><p><code>true</code> if has changed; otherwise, <code>false</code>.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Spreadsheet_IRange_AutoFilter_" data-uid="GrapeCity.Spreadsheet.IRange.AutoFilter*"></a>
<h4 id="GrapeCity_Spreadsheet_IRange_AutoFilter_System_Int32_GrapeCity_Spreadsheet_Color_" data-uid="GrapeCity.Spreadsheet.IRange.AutoFilter(System.Int32,GrapeCity.Spreadsheet.Color)">AutoFilter(int, Color)</h4>
<div class="markdown level1 summary"><p>Add the font color filter.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">bool AutoFilter(int columnIndex, Color color)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Function AutoFilter(columnIndex As Integer, color As Color) As Boolean</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="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">columnIndex</span></td>
      <td><p>Index of the column.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="GrapeCity.Spreadsheet.Color.html">Color</a></td>
      <td><span class="parametername">color</span></td>
      <td><p>Color of the font.</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="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><p><code>true</code> if has changed; otherwise, <code>false</code>.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Spreadsheet_IRange_AutoFilter_" data-uid="GrapeCity.Spreadsheet.IRange.AutoFilter*"></a>
<h4 id="GrapeCity_Spreadsheet_IRange_AutoFilter_System_Int32_GrapeCity_Spreadsheet_DynamicFilterType_" data-uid="GrapeCity.Spreadsheet.IRange.AutoFilter(System.Int32,GrapeCity.Spreadsheet.DynamicFilterType)">AutoFilter(int, DynamicFilterType)</h4>
<div class="markdown level1 summary"><p>Add the dynamic filter.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">bool AutoFilter(int columnIndex, DynamicFilterType dynamicType)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Function AutoFilter(columnIndex As Integer, dynamicType As DynamicFilterType) As Boolean</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="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">columnIndex</span></td>
      <td><p>Index of the column.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="GrapeCity.Spreadsheet.DynamicFilterType.html">DynamicFilterType</a></td>
      <td><span class="parametername">dynamicType</span></td>
      <td><p>A <a class="xref" href="GrapeCity.Spreadsheet.DynamicFilterType.html">DynamicFilterType</a> value indicates the dynamic filter type.</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="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><p><code>true</code> if has changed; otherwise, <code>false</code>.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Spreadsheet_IRange_AutoFilter_" data-uid="GrapeCity.Spreadsheet.IRange.AutoFilter*"></a>
<h4 id="GrapeCity_Spreadsheet_IRange_AutoFilter_System_Int32_GrapeCity_Spreadsheet_CfIcon_" data-uid="GrapeCity.Spreadsheet.IRange.AutoFilter(System.Int32,GrapeCity.Spreadsheet.CfIcon)">AutoFilter(int, CfIcon)</h4>
<div class="markdown level1 summary"><p>Add the icon filter.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">bool AutoFilter(int columnIndex, CfIcon icon)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Function AutoFilter(columnIndex As Integer, icon As CfIcon) As Boolean</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="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">columnIndex</span></td>
      <td><p>Index of the column.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="GrapeCity.Spreadsheet.CfIcon.html">CfIcon</a></td>
      <td><span class="parametername">icon</span></td>
      <td><p>A <a class="xref" href="GrapeCity.Spreadsheet.CfIcon.html">CfIcon</a> value represents the icon which is used to filter.</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="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><p><code>true</code> if has changed; otherwise, <code>false</code>.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Spreadsheet_IRange_AutoFilter_" data-uid="GrapeCity.Spreadsheet.IRange.AutoFilter*"></a>
<h4 id="GrapeCity_Spreadsheet_IRange_AutoFilter_System_Int32_System_Object_GrapeCity_Spreadsheet_AutoFilterOperator_System_Object_" data-uid="GrapeCity.Spreadsheet.IRange.AutoFilter(System.Int32,System.Object,GrapeCity.Spreadsheet.AutoFilterOperator,System.Object)">AutoFilter(int, object, AutoFilterOperator, object)</h4>
<div class="markdown level1 summary"><p>Filters a list using the AutoFilter.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">bool AutoFilter(int columnIndex, object criteria1 = null, AutoFilterOperator filterOperator = AutoFilterOperator.And, object criteria2 = null)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Function AutoFilter(columnIndex As Integer, Optional criteria1 As Object = Nothing, Optional filterOperator As AutoFilterOperator = AutoFilterOperator.And, Optional criteria2 As Object = Nothing) As Boolean</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="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">columnIndex</span></td>
      <td><p>Index of the column.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></td>
      <td><span class="parametername">criteria1</span></td>
      <td><p>The first criteria is corresponding the first filter criteria.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="GrapeCity.Spreadsheet.AutoFilterOperator.html">AutoFilterOperator</a></td>
      <td><span class="parametername">filterOperator</span></td>
      <td><p>The value specifying the type of filter.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></td>
      <td><span class="parametername">criteria2</span></td>
      <td><p>The second criteria is corresponding the second filter criteria.</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="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><p><code>true</code> if has changed; otherwise, <code>false</code>.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="GrapeCity_Spreadsheet_IRange_AutoFilter_System_Int32_System_Object_GrapeCity_Spreadsheet_AutoFilterOperator_System_Object__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>If <code class="paramref">filterOperator</code> is <a class="xref" href="GrapeCity.Spreadsheet.AutoFilterOperator.html#GrapeCity_Spreadsheet_AutoFilterOperator_FilterValues">FilterValues</a>, <code class="paramref">criteria1</code> can be string[] or DateGroupItem[] array.</p>
</div>
</div>
