# C1.Win.TreeView.C1TreeView.WriteXml

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Win_TreeView_C1TreeView_WriteXml_" data-uid="C1.Win.TreeView.C1TreeView.WriteXml*">WriteXml Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Win_TreeView_C1TreeView_WriteXml_" data-uid="C1.Win.TreeView.C1TreeView.WriteXml*"></a>
<h4 id="C1_Win_TreeView_C1TreeView_WriteXml_System_String_System_Boolean_System_Boolean_" data-uid="C1.Win.TreeView.C1TreeView.WriteXml(System.String,System.Boolean,System.Boolean)">WriteXml(string, bool, bool)</h4>
<div class="markdown level1 summary"><p>Saves the treeview contents to an Xml document.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void WriteXml(string fileName, bool saveStyles = true, bool saveExpandedState = true)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub WriteXml(fileName As String, Optional saveStyles As Boolean = True, Optional saveExpandedState As Boolean = True)</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">fileName</span></td>
      <td><p>Name of the file to save, including the path.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">saveStyles</span></td>
      <td><p>Save styles of treeview.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">saveExpandedState</span></td>
      <td><p>Save treeview in expanded/collapsed state.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_Win_TreeView_C1TreeView_WriteXml_" data-uid="C1.Win.TreeView.C1TreeView.WriteXml*"></a>
<h4 id="C1_Win_TreeView_C1TreeView_WriteXml_System_IO_TextWriter_System_Boolean_System_Boolean_" data-uid="C1.Win.TreeView.C1TreeView.WriteXml(System.IO.TextWriter,System.Boolean,System.Boolean)">WriteXml(TextWriter, bool, bool)</h4>
<div class="markdown level1 summary"><p>Saves the treeview contents to an Xml document.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void WriteXml(TextWriter tw, bool saveStyles = true, bool saveExpandedState = true)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub WriteXml(tw As TextWriter, Optional saveStyles As Boolean = True, Optional saveExpandedState As Boolean = True)</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.io.textwriter">TextWriter</a></td>
      <td><span class="parametername">tw</span></td>
      <td><p>The <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.io.textwriter">TextWriter</a> where the document is saved.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">saveStyles</span></td>
      <td><p>Save styles of treeview.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">saveExpandedState</span></td>
      <td><p>Save treeview in expanded/collapsed state.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_Win_TreeView_C1TreeView_WriteXml_" data-uid="C1.Win.TreeView.C1TreeView.WriteXml*"></a>
<h4 id="C1_Win_TreeView_C1TreeView_WriteXml_System_IO_Stream_System_Boolean_System_Boolean_" data-uid="C1.Win.TreeView.C1TreeView.WriteXml(System.IO.Stream,System.Boolean,System.Boolean)">WriteXml(Stream, bool, bool)</h4>
<div class="markdown level1 summary"><p>Saves the treeview contents to an Xml document.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void WriteXml(Stream stream, bool saveStyles = true, bool saveExpandedState = true)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub WriteXml(stream As Stream, Optional saveStyles As Boolean = True, Optional saveExpandedState As Boolean = True)</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.io.stream">Stream</a></td>
      <td><span class="parametername">stream</span></td>
      <td><p>The <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.io.stream">Stream</a> where the document is saved.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">saveStyles</span></td>
      <td><p>Save styles of treeview.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">saveExpandedState</span></td>
      <td><p>Save treeview in expanded/collapsed state.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_Win_TreeView_C1TreeView_WriteXml_" data-uid="C1.Win.TreeView.C1TreeView.WriteXml*"></a>
<h4 id="C1_Win_TreeView_C1TreeView_WriteXml_System_Xml_XmlTextWriter_System_Boolean_System_Boolean_" data-uid="C1.Win.TreeView.C1TreeView.WriteXml(System.Xml.XmlTextWriter,System.Boolean,System.Boolean)">WriteXml(XmlTextWriter, bool, bool)</h4>
<div class="markdown level1 summary"><p>Saves the treeview contents to an Xml document.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void WriteXml(XmlTextWriter w, bool saveStyles = true, bool saveExpandedState = true)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub WriteXml(w As XmlTextWriter, Optional saveStyles As Boolean = True, Optional saveExpandedState As Boolean = True)</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">XmlTextWriter</span></td>
      <td><span class="parametername">w</span></td>
      <td><p>The <span class="xref">System.Xml.XmlTextWriter</span> where the document is saved.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">saveStyles</span></td>
      <td><p>Save styles of treeview.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">saveExpandedState</span></td>
      <td><p>Save treeview in expanded/collapsed state.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
