# C1.Win.C1Editor.C1TextRange.ApplyClass

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Win_C1Editor_C1TextRange_ApplyClass_" data-uid="C1.Win.C1Editor.C1TextRange.ApplyClass*">ApplyClass Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Win_C1Editor_C1TextRange_ApplyClass_" data-uid="C1.Win.C1Editor.C1TextRange.ApplyClass*"></a>
<h4 id="C1_Win_C1Editor_C1TextRange_ApplyClass_System_String_" data-uid="C1.Win.C1Editor.C1TextRange.ApplyClass(System.String)">ApplyClass(string)</h4>
<div class="markdown level1 summary"><p>Applies specified CSS class to the text range.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void ApplyClass(string className)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub ApplyClass(className 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">className</span></td>
      <td><p>The name of a CSS class to apply to the current text range.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_Win_C1Editor_C1TextRange_ApplyClass_" data-uid="C1.Win.C1Editor.C1TextRange.ApplyClass*"></a>
<h4 id="C1_Win_C1Editor_C1TextRange_ApplyClass_System_String_C1_Win_C1Editor_C1StyleType_" data-uid="C1.Win.C1Editor.C1TextRange.ApplyClass(System.String,C1.Win.C1Editor.C1StyleType)">ApplyClass(string, C1StyleType)</h4>
<div class="markdown level1 summary"><p>Applies specified CSS class to the text range.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void ApplyClass(string className, C1StyleType type)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub ApplyClass(className As String, type As C1StyleType)</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">className</span></td>
      <td><p>The name of a CSS class to apply to the current text range.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Win.C1Editor.C1StyleType.html">C1StyleType</a></td>
      <td><span class="parametername">type</span></td>
      <td><p>Defines type of content to which the inline style must be applied.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Win_C1Editor_C1TextRange_ApplyClass_System_String_C1_Win_C1Editor_C1StyleType__examples">Examples</h5>
<p>This code applies a &quot;main_topic&quot; class to the paragraph.
<pre><code class="lang-csharp">range.ApplyClass(&quot;main_topic&quot;, C1StyleType.Paragraph);</code></pre>

</div>
