# GrapeCity.Documents.Word.Fields.TocStyleLevelCollection

## Content

<div class="doc-site-dotnet-api-container">



  <h1 id="GrapeCity_Documents_Word_Fields_TocStyleLevelCollection" data-uid="GrapeCity.Documents.Word.Fields.TocStyleLevelCollection" class="text-break">TocStyleLevelCollection Class
</h1>
  <div class="markdown level0 summary"><p>Represents a collection of styles for which paragraphs should be collected by the TOC field.</p>
<p>By default it contains all built-in heading styles like "Heading 1", "heading 2" etc.</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">TocStyleLevelCollection</span></div>
  </div>
  <div class="implements">
    <h5>Implements</h5>
    <div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1">IEnumerable</a>&lt;<a class="xref" href="GrapeCity.Documents.Word.Fields.TocStyleLevel.html">TocStyleLevel</a>&gt;</div>
    <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="GrapeCity.Documents.Word.Fields.html">GrapeCity.Documents.Word.Fields</a></h6>
  <h6><strong>Assembly</strong>: DS.Documents.Word.dll</h6>
  <h5 id="GrapeCity_Documents_Word_Fields_TocStyleLevelCollection_syntax">Syntax</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public class TocStyleLevelCollection : IEnumerable&lt;TocStyleLevel&gt;, IEnumerable</code></pre>
  </div>
  <div class="codewrapper">
    <pre><code class="lang-vbnet hljs">Public Class TocStyleLevelCollection
    Implements IEnumerable(Of TocStyleLevel), IEnumerable</code></pre>
  </div>
  <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="GrapeCity_Documents_Word_Fields_TocStyleLevelCollection_Collect" data-uid="GrapeCity.Documents.Word.Fields.TocStyleLevelCollection.Collect">
          <a class="xref" href="GrapeCity.Documents.Word.Fields.TocStyleLevelCollection.Collect.html#GrapeCity_Documents_Word_Fields_TocStyleLevelCollection_Collect">Collect</a>
        </td>
        <td class="markdown level1 summary"><p>Gets or sets a value indicating whether to collect paragraphs formatted with styles from the collection.</p>
<p>The default value is <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">true</a>.</p> 
<p>If both <a class="xref" href="GrapeCity.Documents.Word.Fields.TocTcOptions.Collect.html#GrapeCity_Documents_Word_Fields_TocTcOptions_Collect">Collect</a> and <a class="xref" href="GrapeCity.Documents.Word.Fields.TocSeqOptions.Collect.html#GrapeCity_Documents_Word_Fields_TocSeqOptions_Collect">Collect</a> are <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">false</a>,
this property returns <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">true</a>.</p>
</td>
      </tr>
      <tr>
        <td id="GrapeCity_Documents_Word_Fields_TocStyleLevelCollection_Count" data-uid="GrapeCity.Documents.Word.Fields.TocStyleLevelCollection.Count">
          <a class="xref" href="GrapeCity.Documents.Word.Fields.TocStyleLevelCollection.Count.html#GrapeCity_Documents_Word_Fields_TocStyleLevelCollection_Count">Count</a>
        </td>
        <td class="markdown level1 summary"><p>Gets the number of <a class="xref" href="GrapeCity.Documents.Word.Fields.TocStyleLevel.html">TocStyleLevel</a> in this collection.</p>
</td>
      </tr>
      <tr>
        <td id="GrapeCity_Documents_Word_Fields_TocStyleLevelCollection_Item_System_String_" data-uid="GrapeCity.Documents.Word.Fields.TocStyleLevelCollection.Item(System.String)">
          <a class="xref" href="GrapeCity.Documents.Word.Fields.TocStyleLevelCollection.Item.html#GrapeCity_Documents_Word_Fields_TocStyleLevelCollection_Item_System_String_">this[string]</a>
        </td>
        <td class="markdown level1 summary"><p>Gets the <a class="xref" href="GrapeCity.Documents.Word.Fields.TocStyleLevel.html">TocStyleLevel</a> associated with a specified style name.</p>
</td>
      </tr>
      <tr>
        <td id="GrapeCity_Documents_Word_Fields_TocStyleLevelCollection_OutlineLevels" data-uid="GrapeCity.Documents.Word.Fields.TocStyleLevelCollection.OutlineLevels">
          <a class="xref" href="GrapeCity.Documents.Word.Fields.TocStyleLevelCollection.OutlineLevels.html#GrapeCity_Documents_Word_Fields_TocStyleLevelCollection_OutlineLevels">OutlineLevels</a>
        </td>
        <td class="markdown level1 summary"><p>Gets the range of paragraph outline levels that should be collected by the TOC field when <a class="xref" href="GrapeCity.Documents.Word.Fields.TocStyleLevelCollection.UseParagraphOutlineLevel.html#GrapeCity_Documents_Word_Fields_TocStyleLevelCollection_UseParagraphOutlineLevel">UseParagraphOutlineLevel</a> is <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">true</a>.</p>
</td>
      </tr>
      <tr>
        <td id="GrapeCity_Documents_Word_Fields_TocStyleLevelCollection_UseParagraphOutlineLevel" data-uid="GrapeCity.Documents.Word.Fields.TocStyleLevelCollection.UseParagraphOutlineLevel">
          <a class="xref" href="GrapeCity.Documents.Word.Fields.TocStyleLevelCollection.UseParagraphOutlineLevel.html#GrapeCity_Documents_Word_Fields_TocStyleLevelCollection_UseParagraphOutlineLevel">UseParagraphOutlineLevel</a>
        </td>
        <td class="markdown level1 summary"><p>Gets or sets a value indicating whether to use outline level applied to paragraph instead of styles.</p>
<p>The default value is <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">false</a>.</p> 
<p>If <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">true</a>, the TOC field collects paragraphs whose outline level corresponds to the <a class="xref" href="GrapeCity.Documents.Word.Fields.TocStyleLevelCollection.OutlineLevels.html#GrapeCity_Documents_Word_Fields_TocStyleLevelCollection_OutlineLevels">OutlineLevels</a> property.</p>
<p>Paragraphs formatted with custom styles listed in this collection will be collected unless their outline level is <a class="xref" href="GrapeCity.Documents.Word.OutlineLevel.html#GrapeCity_Documents_Word_OutlineLevel_BodyText">BodyText</a>.</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="GrapeCity_Documents_Word_Fields_TocStyleLevelCollection_Add_System_String_GrapeCity_Documents_Word_OutlineLevel_" data-uid="GrapeCity.Documents.Word.Fields.TocStyleLevelCollection.Add(System.String,GrapeCity.Documents.Word.OutlineLevel)">
          <a class="xref" href="GrapeCity.Documents.Word.Fields.TocStyleLevelCollection.Add.html#GrapeCity_Documents_Word_Fields_TocStyleLevelCollection_Add_System_String_GrapeCity_Documents_Word_OutlineLevel_">Add(string, OutlineLevel)</a>
        </td>
        <td class="markdown level1 summary"><p>Adds the specified style to the collection.</p>
</td>
      </tr>
      <tr>
        <td id="GrapeCity_Documents_Word_Fields_TocStyleLevelCollection_Contains_System_String_" data-uid="GrapeCity.Documents.Word.Fields.TocStyleLevelCollection.Contains(System.String)">
          <a class="xref" href="GrapeCity.Documents.Word.Fields.TocStyleLevelCollection.Contains.html#GrapeCity_Documents_Word_Fields_TocStyleLevelCollection_Contains_System_String_">Contains(string)</a>
        </td>
        <td class="markdown level1 summary"><p>Gets a value indicating whether the collection contains a <a class="xref" href="GrapeCity.Documents.Word.Fields.TocStyleLevel.html">TocStyleLevel</a> associated with a specified style name.</p>
</td>
      </tr>
      <tr>
        <td id="GrapeCity_Documents_Word_Fields_TocStyleLevelCollection_GetEnumerator" data-uid="GrapeCity.Documents.Word.Fields.TocStyleLevelCollection.GetEnumerator">
          <a class="xref" href="GrapeCity.Documents.Word.Fields.TocStyleLevelCollection.GetEnumerator.html#GrapeCity_Documents_Word_Fields_TocStyleLevelCollection_GetEnumerator">GetEnumerator()</a>
        </td>
        <td class="markdown level1 summary"></td>
      </tr>
      <tr>
        <td id="GrapeCity_Documents_Word_Fields_TocStyleLevelCollection_Remove_System_String_" data-uid="GrapeCity.Documents.Word.Fields.TocStyleLevelCollection.Remove(System.String)">
          <a class="xref" href="GrapeCity.Documents.Word.Fields.TocStyleLevelCollection.Remove.html#GrapeCity_Documents_Word_Fields_TocStyleLevelCollection_Remove_System_String_">Remove(string)</a>
        </td>
        <td class="markdown level1 summary"><p>Removes a <a class="xref" href="GrapeCity.Documents.Word.Fields.TocStyleLevel.html">TocStyleLevel</a> from the collection.</p>
</td>
      </tr>
      <tr>
        <td id="GrapeCity_Documents_Word_Fields_TocStyleLevelCollection_ToString" data-uid="GrapeCity.Documents.Word.Fields.TocStyleLevelCollection.ToString">
          <a class="xref" href="GrapeCity.Documents.Word.Fields.TocStyleLevelCollection.ToString.html#GrapeCity_Documents_Word_Fields_TocStyleLevelCollection_ToString">ToString()</a>
        </td>
        <td class="markdown level1 summary"></td>
      </tr>
      <tr>
        <td id="GrapeCity_Documents_Word_Fields_TocStyleLevelCollection_TryGetStyle_System_String_GrapeCity_Documents_Word_Fields_TocStyleLevel__" data-uid="GrapeCity.Documents.Word.Fields.TocStyleLevelCollection.TryGetStyle(System.String,GrapeCity.Documents.Word.Fields.TocStyleLevel@)">
          <a class="xref" href="GrapeCity.Documents.Word.Fields.TocStyleLevelCollection.TryGetStyle.html#GrapeCity_Documents_Word_Fields_TocStyleLevelCollection_TryGetStyle_System_String_GrapeCity_Documents_Word_Fields_TocStyleLevel__">TryGetStyle(string, out TocStyleLevel)</a>
        </td>
        <td class="markdown level1 summary"><p>Tries to get the <a class="xref" href="GrapeCity.Documents.Word.Fields.TocStyleLevel.html">TocStyleLevel</a> associated with a specified style name.</p>
</td>
      </tr>
    </tbody>
  </table>

</div>
