# C1.C1Excel.XLSheetCollection

## Content

<div class="doc-site-dotnet-api-container">



  <h1 id="C1_C1Excel_XLSheetCollection" data-uid="C1.C1Excel.XLSheetCollection" class="text-break">XLSheetCollection Class
</h1>
  <div class="markdown level0 summary"><p>Collection of <a class="xref" href="C1.C1Excel.XLSheet.html">XLSheet</a> objects that represent the individual
worksheets in a <a class="xref" href="C1.C1Excel.C1XLBook.html">C1XLBook</a>.</p>
</div>
  <div class="markdown level0 conceptual"></div>
  <div class="inheritance">
    <h5>Inheritance</h5>
    <div class="level0"><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div>
    <div class="level1"><span class="xref">XLSheetCollection</span></div>
  </div>
  <div class="implements">
    <h5>Implements</h5>
    <div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.ienumerable">IEnumerable</a></div>
  </div>
  <h6><strong>Namespace</strong>: <a class="xref" href="C1.C1Excel.html">C1.C1Excel</a></h6>
  <h6><strong>Assembly</strong>: C1.C1Excel.4.8.dll</h6>
  <h5 id="C1_C1Excel_XLSheetCollection_syntax">Syntax</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public class XLSheetCollection : IEnumerable</code></pre>
  </div>
  <div class="codewrapper">
    <pre><code class="lang-vbnet hljs">Public Class XLSheetCollection
    Implements IEnumerable</code></pre>
  </div>
  <h5 id="C1_C1Excel_XLSheetCollection_remarks"><strong>Remarks</strong></h5>
  <div class="markdown level0 remarks"><p>Provides methods and properties for counting, enumerating, adding, and removing sheets from
the workbook.</p>
</div>
  <h5 id="C1_C1Excel_XLSheetCollection_examples"><strong>Examples</strong></h5>
  <p>Use the <a class="xref" href="C1.C1Excel.C1XLBook.html">C1XLBook</a> <a class="xref" href="C1.C1Excel.C1XLBook.Sheets.html#C1_C1Excel_C1XLBook_Sheets">Sheets</a> property to get the
book's sheet collection. For example, the code below gets a reference
to the first sheet on the book and then prints the sheet's name:</p>
<pre><code class="lang-csharp">C1XLBook book = new C1XLBook();
XLSheet sheet = book.Sheets[0];
Debug.WriteLine(sheet.Name);</code></pre>

  <h3 id="properties">Properties
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="C1_C1Excel_XLSheetCollection_Book" data-uid="C1.C1Excel.XLSheetCollection.Book">
          <a class="xref" href="C1.C1Excel.XLSheetCollection.Book.html#C1_C1Excel_XLSheetCollection_Book">Book</a>
        </td>
        <td class="markdown level1 summary"><p>Gets a reference to the <a class="xref" href="C1.C1Excel.C1XLBook.html">C1XLBook</a> that owns the collection.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Excel_XLSheetCollection_Count" data-uid="C1.C1Excel.XLSheetCollection.Count">
          <a class="xref" href="C1.C1Excel.XLSheetCollection.Count.html#C1_C1Excel_XLSheetCollection_Count">Count</a>
        </td>
        <td class="markdown level1 summary"><p>Gets the number of <a class="xref" href="C1.C1Excel.XLSheet.html">XLSheet</a> objects in the collection.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Excel_XLSheetCollection_FirstIndex" data-uid="C1.C1Excel.XLSheetCollection.FirstIndex">
          <a class="xref" href="C1.C1Excel.XLSheetCollection.FirstIndex.html#C1_C1Excel_XLSheetCollection_FirstIndex">FirstIndex</a>
        </td>
        <td class="markdown level1 summary"><p>Gets or sets the index of the sheet that is initially opened
when a <a class="xref" href="C1.C1Excel.C1XLBook.html">C1XLBook</a> file is loaded into Excel.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Excel_XLSheetCollection_Item_System_Int32_" data-uid="C1.C1Excel.XLSheetCollection.Item(System.Int32)">
          <a class="xref" href="C1.C1Excel.XLSheetCollection.Item.html#C1_C1Excel_XLSheetCollection_Item_System_Int32_">this[int]</a>
        </td>
        <td class="markdown level1 summary"><p>Gets the <a class="xref" href="C1.C1Excel.XLSheet.html">XLSheet</a> at a given position in the collection.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Excel_XLSheetCollection_Item_System_String_" data-uid="C1.C1Excel.XLSheetCollection.Item(System.String)">
          <a class="xref" href="C1.C1Excel.XLSheetCollection.Item.html#C1_C1Excel_XLSheetCollection_Item_System_String_">this[string]</a>
        </td>
        <td class="markdown level1 summary"><p>Gets the <a class="xref" href="C1.C1Excel.XLSheet.html">XLSheet</a> with the given name (case-insensitive).</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Excel_XLSheetCollection_SelectedIndex" data-uid="C1.C1Excel.XLSheetCollection.SelectedIndex">
          <a class="xref" href="C1.C1Excel.XLSheetCollection.SelectedIndex.html#C1_C1Excel_XLSheetCollection_SelectedIndex">SelectedIndex</a>
        </td>
        <td class="markdown level1 summary"><p>Gets or sets the index of the sheet that is selected
when a <a class="xref" href="C1.C1Excel.C1XLBook.html">C1XLBook</a> file is loaded into Excel.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Excel_XLSheetCollection_SelectedIndexes" data-uid="C1.C1Excel.XLSheetCollection.SelectedIndexes">
          <a class="xref" href="C1.C1Excel.XLSheetCollection.SelectedIndexes.html#C1_C1Excel_XLSheetCollection_SelectedIndexes">SelectedIndexes</a>
        </td>
        <td class="markdown level1 summary"><p>Gets or sets the index array of the sheets that is selected
when a <a class="xref" href="C1.C1Excel.C1XLBook.html">C1XLBook</a> file is loaded into Excel.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h3 id="methods">Methods
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="C1_C1Excel_XLSheetCollection_Add" data-uid="C1.C1Excel.XLSheetCollection.Add">
          <a class="xref" href="C1.C1Excel.XLSheetCollection.Add.html#C1_C1Excel_XLSheetCollection_Add">Add()</a>
        </td>
        <td class="markdown level1 summary"><p>Creates a new <a class="xref" href="C1.C1Excel.XLSheet.html">XLSheet</a> and appends it to the collection.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Excel_XLSheetCollection_Add_C1_C1Excel_XLSheet_" data-uid="C1.C1Excel.XLSheetCollection.Add(C1.C1Excel.XLSheet)">
          <a class="xref" href="C1.C1Excel.XLSheetCollection.Add.html#C1_C1Excel_XLSheetCollection_Add_C1_C1Excel_XLSheet_">Add(XLSheet)</a>
        </td>
        <td class="markdown level1 summary"><p>Appends an existing <a class="xref" href="C1.C1Excel.XLSheet.html">XLSheet</a> to the collection.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Excel_XLSheetCollection_Add_System_String_" data-uid="C1.C1Excel.XLSheetCollection.Add(System.String)">
          <a class="xref" href="C1.C1Excel.XLSheetCollection.Add.html#C1_C1Excel_XLSheetCollection_Add_System_String_">Add(string)</a>
        </td>
        <td class="markdown level1 summary"><p>Creates a new <a class="xref" href="C1.C1Excel.XLSheet.html">XLSheet</a> with a given name and appends it to the collection.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Excel_XLSheetCollection_Clear" data-uid="C1.C1Excel.XLSheetCollection.Clear">
          <a class="xref" href="C1.C1Excel.XLSheetCollection.Clear.html#C1_C1Excel_XLSheetCollection_Clear">Clear()</a>
        </td>
        <td class="markdown level1 summary"><p>Removes all items from the collection.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Excel_XLSheetCollection_Contains_C1_C1Excel_XLSheet_" data-uid="C1.C1Excel.XLSheetCollection.Contains(C1.C1Excel.XLSheet)">
          <a class="xref" href="C1.C1Excel.XLSheetCollection.Contains.html#C1_C1Excel_XLSheetCollection_Contains_C1_C1Excel_XLSheet_">Contains(XLSheet)</a>
        </td>
        <td class="markdown level1 summary"><p>Determines whether the collection contains a specific <a class="xref" href="C1.C1Excel.XLSheet.html">XLSheet</a> object.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Excel_XLSheetCollection_Contains_System_String_" data-uid="C1.C1Excel.XLSheetCollection.Contains(System.String)">
          <a class="xref" href="C1.C1Excel.XLSheetCollection.Contains.html#C1_C1Excel_XLSheetCollection_Contains_System_String_">Contains(string)</a>
        </td>
        <td class="markdown level1 summary"><p>Determines whether the collection contains an <a class="xref" href="C1.C1Excel.XLSheet.html">XLSheet</a> object
with a given name.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Excel_XLSheetCollection_IndexOf_C1_C1Excel_XLSheet_" data-uid="C1.C1Excel.XLSheetCollection.IndexOf(C1.C1Excel.XLSheet)">
          <a class="xref" href="C1.C1Excel.XLSheetCollection.IndexOf.html#C1_C1Excel_XLSheetCollection_IndexOf_C1_C1Excel_XLSheet_">IndexOf(XLSheet)</a>
        </td>
        <td class="markdown level1 summary"><p>Gets the index of a given <a class="xref" href="C1.C1Excel.XLSheet.html">XLSheet</a> in the collection.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Excel_XLSheetCollection_IndexOf_System_String_" data-uid="C1.C1Excel.XLSheetCollection.IndexOf(System.String)">
          <a class="xref" href="C1.C1Excel.XLSheetCollection.IndexOf.html#C1_C1Excel_XLSheetCollection_IndexOf_System_String_">IndexOf(string)</a>
        </td>
        <td class="markdown level1 summary"><p>Gets the position of the sheet with the specified name in the collection.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Excel_XLSheetCollection_Insert_System_Int32_" data-uid="C1.C1Excel.XLSheetCollection.Insert(System.Int32)">
          <a class="xref" href="C1.C1Excel.XLSheetCollection.Insert.html#C1_C1Excel_XLSheetCollection_Insert_System_Int32_">Insert(int)</a>
        </td>
        <td class="markdown level1 summary"><p>Creates a new <a class="xref" href="C1.C1Excel.XLSheet.html">XLSheet</a> and inserts it at a specific
position in the collection.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Excel_XLSheetCollection_Insert_System_Int32_C1_C1Excel_XLSheet_" data-uid="C1.C1Excel.XLSheetCollection.Insert(System.Int32,C1.C1Excel.XLSheet)">
          <a class="xref" href="C1.C1Excel.XLSheetCollection.Insert.html#C1_C1Excel_XLSheetCollection_Insert_System_Int32_C1_C1Excel_XLSheet_">Insert(int, XLSheet)</a>
        </td>
        <td class="markdown level1 summary"><p>Inserts an <a class="xref" href="C1.C1Excel.XLSheet.html">XLSheet</a> object into the collection at the specified position.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Excel_XLSheetCollection_Remove_C1_C1Excel_XLSheet_" data-uid="C1.C1Excel.XLSheetCollection.Remove(C1.C1Excel.XLSheet)">
          <a class="xref" href="C1.C1Excel.XLSheetCollection.Remove.html#C1_C1Excel_XLSheetCollection_Remove_C1_C1Excel_XLSheet_">Remove(XLSheet)</a>
        </td>
        <td class="markdown level1 summary"><p>Removes an <a class="xref" href="C1.C1Excel.XLSheet.html">XLSheet</a> from the collection.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Excel_XLSheetCollection_Remove_System_String_" data-uid="C1.C1Excel.XLSheetCollection.Remove(System.String)">
          <a class="xref" href="C1.C1Excel.XLSheetCollection.Remove.html#C1_C1Excel_XLSheetCollection_Remove_System_String_">Remove(string)</a>
        </td>
        <td class="markdown level1 summary"><p>Removes the <a class="xref" href="C1.C1Excel.XLSheet.html">XLSheet</a> with the specified name from the collection.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Excel_XLSheetCollection_RemoveAt_System_Int32_" data-uid="C1.C1Excel.XLSheetCollection.RemoveAt(System.Int32)">
          <a class="xref" href="C1.C1Excel.XLSheetCollection.RemoveAt.html#C1_C1Excel_XLSheetCollection_RemoveAt_System_Int32_">RemoveAt(int)</a>
        </td>
        <td class="markdown level1 summary"><p>Removes the <a class="xref" href="C1.C1Excel.XLSheet.html">XLSheet</a> at a specific index from the collection.</p>
</td>
      </tr>
    </tbody>
  </table>

</div>
