# GrapeCity.Documents.Excel.IRange.AutoFit

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_Documents_Excel_IRange_AutoFit_" data-uid="GrapeCity.Documents.Excel.IRange.AutoFit*">AutoFit Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_Documents_Excel_IRange_AutoFit_" data-uid="GrapeCity.Documents.Excel.IRange.AutoFit*"></a>
<h4 id="GrapeCity_Documents_Excel_IRange_AutoFit" data-uid="GrapeCity.Documents.Excel.IRange.AutoFit">AutoFit()</h4>
<div class="markdown level1 summary"><p>Changes the width of the columns in the range or the height of the rows in the range to achieve the best fit.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">void AutoFit()</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Sub AutoFit()</code></pre>
</div>


<a id="GrapeCity_Documents_Excel_IRange_AutoFit_" data-uid="GrapeCity.Documents.Excel.IRange.AutoFit*"></a>
<h4 id="GrapeCity_Documents_Excel_IRange_AutoFit_System_Boolean_" data-uid="GrapeCity.Documents.Excel.IRange.AutoFit(System.Boolean)">AutoFit(bool)</h4>
<div class="markdown level1 summary"><p>Changes the width of the columns in the range or the height of the rows in the range to achieve the best fit.
<code class="paramref">considerMergedCell</code> Indicates whether to consider merged cells in a single row.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">void AutoFit(bool considerMergedCell)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Sub AutoFit(considerMergedCell 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">considerMergedCell</span></td>
      <td></td>
    </tr>
  </tbody>
</table>
</div>
