# GrapeCity.Documents.Excel.ICustomXmlPartCollection.Add

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_Documents_Excel_ICustomXmlPartCollection_Add_" data-uid="GrapeCity.Documents.Excel.ICustomXmlPartCollection.Add*">Add Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_Documents_Excel_ICustomXmlPartCollection_Add_" data-uid="GrapeCity.Documents.Excel.ICustomXmlPartCollection.Add*"></a>
<h4 id="GrapeCity_Documents_Excel_ICustomXmlPartCollection_Add" data-uid="GrapeCity.Documents.Excel.ICustomXmlPartCollection.Add">Add()</h4>
<div class="markdown level1 summary"><p>Adds a new Custom XML part.</p>
<p>
The new part receives a generated ID. Set the XML payload by using <a class="xref" href="GrapeCity.Documents.Excel.ICustomXmlPart.Data.html#GrapeCity_Documents_Excel_ICustomXmlPart_Data">Data</a>
before saving the workbook.
</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">ICustomXmlPart Add()</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Function Add() As ICustomXmlPart</code></pre>
</div>
<h5 class="returns">Returns</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 newly created Custom XML part.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="GrapeCity_Documents_Excel_ICustomXmlPartCollection_Add_examples">Examples</h5>
<pre><code class="lang-csharp">ICustomXmlPart customXmlPart = workbook.CustomXmlParts.Add();
customXmlPart.Data = System.Text.Encoding.UTF8.GetBytes("&lt;customer id=\"42\"/&gt;");
string id = customXmlPart.Id;</code></pre>

</div>
