# GrapeCity.Documents.Word.Templates.DataTemplate.Validate

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_Documents_Word_Templates_DataTemplate_Validate_" data-uid="GrapeCity.Documents.Word.Templates.DataTemplate.Validate*">Validate Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_Documents_Word_Templates_DataTemplate_Validate_" data-uid="GrapeCity.Documents.Word.Templates.DataTemplate.Validate*"></a>
<h4 id="GrapeCity_Documents_Word_Templates_DataTemplate_Validate_System_Boolean_" data-uid="GrapeCity.Documents.Word.Templates.DataTemplate.Validate(System.Boolean)">Validate(bool)</h4>
<div class="markdown level1 summary"><p>Validates all templates in the current document,
finds any template tags that are malformed or used incorrectly.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public IEnumerable&lt;TemplateError&gt; Validate(bool markErrors = false)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function Validate(Optional markErrors As Boolean = False) As IEnumerable(Of TemplateError)</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.boolean">bool</a></td>
      <td><span class="parametername">markErrors</span></td>
      <td><p>If <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">true</a>, erroneous tags will be marked in the document,
and a <a class="xref" href="GrapeCity.Documents.Word.Comment.html">Comment</a> with the error description will be added to each such occurrence.
If <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">false</a>, the templates will be left as is, just the list of errors will be returned.</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.collections.generic.ienumerable-1">IEnumerable</a>&lt;<a class="xref" href="GrapeCity.Documents.Word.Templates.TemplateError.html">TemplateError</a>&gt;</td>
      <td><p>The list of all found template errors.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
