# GrapeCity.Documents.Excel.ICustomXmlPartCollection.Item

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_Documents_Excel_ICustomXmlPartCollection_Item_" data-uid="GrapeCity.Documents.Excel.ICustomXmlPartCollection.Item*">this Property
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_Documents_Excel_ICustomXmlPartCollection_Item_" data-uid="GrapeCity.Documents.Excel.ICustomXmlPartCollection.Item*"></a>
<h4 id="GrapeCity_Documents_Excel_ICustomXmlPartCollection_Item_System_String_" data-uid="GrapeCity.Documents.Excel.ICustomXmlPartCollection.Item(System.String)">this[string]</h4>
<div class="markdown level1 summary"><p>Gets the Custom XML part with the specified ID.</p>
<p>
The ID is the value returned by <a class="xref" href="GrapeCity.Documents.Excel.ICustomXmlPart.Id.html#GrapeCity_Documents_Excel_ICustomXmlPart_Id">Id</a>. This lookup is useful after
a workbook is reopened or when multiple Custom XML parts are stored in the same workbook.
</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">ICustomXmlPart this[string id] { get; }</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">ReadOnly Default Property Item(id As String) As ICustomXmlPart</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.string">string</a></td>
      <td><span class="parametername">id</span></td>
      <td><p>The ID of the Custom XML part.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="propertyValue">Property Value</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="GrapeCity.Documents.Excel.ICustomXmlPart.html">ICustomXmlPart</a></td>
      <td><p>The Custom XML part with the specified ID, or <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null">null</a> if it is not found.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="GrapeCity_Documents_Excel_ICustomXmlPartCollection_Item_System_String__examples">Examples</h5>
<pre><code class="lang-csharp">ICustomXmlPart customXmlPart = workbook.CustomXmlParts.Add();
string id = customXmlPart.Id;

ICustomXmlPart samePart = workbook.CustomXmlParts[id];</code></pre>



<a id="GrapeCity_Documents_Excel_ICustomXmlPartCollection_Item_" data-uid="GrapeCity.Documents.Excel.ICustomXmlPartCollection.Item*"></a>
<h4 id="GrapeCity_Documents_Excel_ICustomXmlPartCollection_Item_System_Int32_" data-uid="GrapeCity.Documents.Excel.ICustomXmlPartCollection.Item(System.Int32)">this[int]</h4>
<div class="markdown level1 summary"><p>Gets the Custom XML part at the specified zero-based index.</p>
<p>
Use the index to enumerate or access parts in collection order. If the index is outside the
valid range, an <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception">ArgumentOutOfRangeException</a> is thrown.
</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">ICustomXmlPart this[int index] { get; }</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">ReadOnly Default Property Item(index As Integer) As ICustomXmlPart</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">index</span></td>
      <td><p>The zero-based index of the Custom XML part.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="propertyValue">Property Value</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="GrapeCity.Documents.Excel.ICustomXmlPart.html">ICustomXmlPart</a></td>
      <td><p>The Custom XML part at the specified index.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="GrapeCity_Documents_Excel_ICustomXmlPartCollection_Item_System_Int32__examples">Examples</h5>
<pre><code class="lang-csharp">if (workbook.CustomXmlParts.Count &gt; 0)
{
    ICustomXmlPart firstPart = workbook.CustomXmlParts[0];
    byte[] xmlData = firstPart.Data;
}</code></pre>

<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Condition</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception">ArgumentOutOfRangeException</a></td>
      <td><p>Thrown when <code class="paramref">index</code> is outside the valid range.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
