# GrapeCity.Documents.Word.XmlMapping.SetMapping

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_Documents_Word_XmlMapping_SetMapping_" data-uid="GrapeCity.Documents.Word.XmlMapping.SetMapping*">SetMapping Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_Documents_Word_XmlMapping_SetMapping_" data-uid="GrapeCity.Documents.Word.XmlMapping.SetMapping*"></a>
<h4 id="GrapeCity_Documents_Word_XmlMapping_SetMapping_System_String_System_String_System_String_System_Boolean_" data-uid="GrapeCity.Documents.Word.XmlMapping.SetMapping(System.String,System.String,System.String,System.Boolean)">SetMapping(string, string, string, bool)</h4>
<div class="markdown level1 summary"><p>Set mapping between a content control and an XML node stored within a Custom XML Data part in the document.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public string SetMapping(string xPath, string prefixMappings = null, string customXmlPartId = null, bool supportRichTextControl = false)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function SetMapping(xPath As String, Optional prefixMappings As String = Nothing, Optional customXmlPartId As String = Nothing, Optional supportRichTextControl As Boolean = False) As String</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">xPath</span></td>
      <td><p>The XPath expression which shall be evaluated to find the custom XML node which
is mapped to the content control.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">prefixMappings</span></td>
      <td><p>The set of prefix mappings which shall be used to interpret the XPath
expression when the XPath expression is evaluated against the custom XML data parts in the document.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">customXmlPartId</span></td>
      <td><p>The <a class="xref" href="GrapeCity.Documents.Word.CustomXmlPart.html">CustomXmlPart</a> identifier which shall be used to
evaluate the given XPath expression.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">supportRichTextControl</span></td>
      <td><p>Whether the xml mapping supports a content control with <a class="xref" href="GrapeCity.Documents.Word.ContentControlType.html#GrapeCity_Documents_Word_ContentControlType_RichText">RichText</a> type.</p>
</td>
    </tr>
  </tbody>
</table>
<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="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><p>Inner xml of the mapped node stored within a <a class="xref" href="GrapeCity.Documents.Word.CustomXmlPart.XmlDocument.html#GrapeCity_Documents_Word_CustomXmlPart_XmlDocument">XmlDocument</a> in the document.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Documents_Word_XmlMapping_SetMapping_" data-uid="GrapeCity.Documents.Word.XmlMapping.SetMapping*"></a>
<h4 id="GrapeCity_Documents_Word_XmlMapping_SetMapping_System_Xml_XmlNode_System_String_System_Boolean_" data-uid="GrapeCity.Documents.Word.XmlMapping.SetMapping(System.Xml.XmlNode,System.String,System.Boolean)">SetMapping(XmlNode, string, bool)</h4>
<div class="markdown level1 summary"><p>Set mapping between a content control and an XML node stored within a Custom XML Data part in the document.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public string SetMapping(XmlNode node, string customXmlPartId = null, bool supportRichTextControl = false)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function SetMapping(node As XmlNode, Optional customXmlPartId As String = Nothing, Optional supportRichTextControl As Boolean = False) As String</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><span class="xref">XmlNode</span></td>
      <td><span class="parametername">node</span></td>
      <td><p>The <span class="xref">System.Xml.XmlNode</span> which is mapped to the content control.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">customXmlPartId</span></td>
      <td><p>The <a class="xref" href="GrapeCity.Documents.Word.CustomXmlPart.html">CustomXmlPart</a> identifier which shall be used to
evaluate the given XPath expression.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">supportRichTextControl</span></td>
      <td><p>Whether the xml mapping supports a content control with
<a class="xref" href="GrapeCity.Documents.Word.ContentControlType.html#GrapeCity_Documents_Word_ContentControlType_RichText">RichText</a> type.</p>
</td>
    </tr>
  </tbody>
</table>
<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="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><p>Inner xml of the mapped node stored within a <a class="xref" href="GrapeCity.Documents.Word.CustomXmlPart.XmlDocument.html#GrapeCity_Documents_Word_CustomXmlPart_XmlDocument">XmlDocument</a> in the document.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Documents_Word_XmlMapping_SetMapping_" data-uid="GrapeCity.Documents.Word.XmlMapping.SetMapping*"></a>
<h4 id="GrapeCity_Documents_Word_XmlMapping_SetMapping__1_System_Linq_Expressions_Expression_System_Func___0___System_Boolean_" data-uid="GrapeCity.Documents.Word.XmlMapping.SetMapping``1(System.Linq.Expressions.Expression{System.Func{``0}},System.Boolean)">SetMapping&lt;T&gt;(Expression&lt;Func&lt;T&gt;&gt;, bool)</h4>
<div class="markdown level1 summary"><p>Set mapping between a content control and an XML node stored within a Custom XML Data part in the document.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public string SetMapping&lt;T&gt;(Expression&lt;Func&lt;T&gt;&gt; builtInDocumentProperty, bool supportRichTextControl = false)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function SetMapping(Of T)(builtInDocumentProperty As Expression(Of Func(Of T)), Optional supportRichTextControl As Boolean = False) As String</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.linq.expressions.expression-1">Expression</a>&lt;<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-1">Func</a>&lt;T&gt;&gt;</td>
      <td><span class="parametername">builtInDocumentProperty</span></td>
      <td><p>The expression of a property from the <a class="xref" href="GrapeCity.Documents.Word.BuiltInPropertyCollection.html">BuiltInPropertyCollection</a> which is mapped to the content control.
Use it like this: SetMapping(() =&gt; document.Settings.BuiltInProperties.Author);</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">supportRichTextControl</span></td>
      <td><p>Whether the xml mapping supports a content control with <a class="xref" href="GrapeCity.Documents.Word.ContentControlType.html#GrapeCity_Documents_Word_ContentControlType_RichText">RichText</a> type.</p>
</td>
    </tr>
  </tbody>
</table>
<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="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><p>Inner xml of the mapped node stored within a <a class="xref" href="GrapeCity.Documents.Word.CustomXmlPart.XmlDocument.html#GrapeCity_Documents_Word_CustomXmlPart_XmlDocument">XmlDocument</a> in the document.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="typeParameters">Type Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><span class="parametername">T</span></td>
      <td></td>
    </tr>
  </tbody>
</table>
</div>
