# GrapeCity.Documents.Excel.IRange.Sort

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_Documents_Excel_IRange_Sort_" data-uid="GrapeCity.Documents.Excel.IRange.Sort*">Sort Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_Documents_Excel_IRange_Sort_" data-uid="GrapeCity.Documents.Excel.IRange.Sort*"></a>
<h4 id="GrapeCity_Documents_Excel_IRange_Sort_GrapeCity_Documents_Excel_SortOrientation_System_Boolean_GrapeCity_Documents_Excel_IValueSortField___" data-uid="GrapeCity.Documents.Excel.IRange.Sort(GrapeCity.Documents.Excel.SortOrientation,System.Boolean,GrapeCity.Documents.Excel.IValueSortField[])">Sort(SortOrientation, bool, params IValueSortField[])</h4>
<div class="markdown level1 summary"><p>Sorts the cells represented by this range according to the specified options.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">void Sort(SortOrientation orientation = SortOrientation.Columns, bool caseSensitive = false, params IValueSortField[] keys)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Sub Sort(Optional orientation As SortOrientation = SortOrientation.Columns, Optional caseSensitive As Boolean = False, ParamArray keys As IValueSortField())</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.Documents.Excel.SortOrientation.html">SortOrientation</a></td>
      <td><span class="parametername">orientation</span></td>
      <td><p>The orientation.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">caseSensitive</span></td>
      <td><p>if set to <code>true</code> [case sensitive].</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="GrapeCity.Documents.Excel.IValueSortField.html">IValueSortField</a>[]</td>
      <td><span class="parametername">keys</span></td>
      <td><p>The <a class="xref" href="GrapeCity.Documents.Excel.SortFieldBase.html">SortFieldBase</a> array.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Documents_Excel_IRange_Sort_" data-uid="GrapeCity.Documents.Excel.IRange.Sort*"></a>
<h4 id="GrapeCity_Documents_Excel_IRange_Sort_GrapeCity_Documents_Excel_IRange_GrapeCity_Documents_Excel_SortOrder_GrapeCity_Documents_Excel_SortOrientation_System_Boolean_" data-uid="GrapeCity.Documents.Excel.IRange.Sort(GrapeCity.Documents.Excel.IRange,GrapeCity.Documents.Excel.SortOrder,GrapeCity.Documents.Excel.SortOrientation,System.Boolean)">Sort(IRange, SortOrder, SortOrientation, bool)</h4>
<div class="markdown level1 summary"><p>Sorts the cells represented by this range according to the specified options.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">void Sort(IRange key, SortOrder order = SortOrder.Ascending, SortOrientation orientation = SortOrientation.Columns, bool caseSensitive = false)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Sub Sort(key As IRange, Optional order As SortOrder = SortOrder.Ascending, Optional orientation As SortOrientation = SortOrientation.Columns, Optional caseSensitive As Boolean = False)</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.Documents.Excel.IRange.html">IRange</a></td>
      <td><span class="parametername">key</span></td>
      <td><p>The key of the sort column.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="GrapeCity.Documents.Excel.SortOrder.html">SortOrder</a></td>
      <td><span class="parametername">order</span></td>
      <td><p>The sort order, ascending or descending</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="GrapeCity.Documents.Excel.SortOrientation.html">SortOrientation</a></td>
      <td><span class="parametername">orientation</span></td>
      <td><p>The orientation.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">caseSensitive</span></td>
      <td><p>if set to <code>true</code> [case sensitive].</p>
</td>
    </tr>
  </tbody>
</table>
</div>
