# C1.Win.C1Editor.C1TextRange.ApplyStyle

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Win_C1Editor_C1TextRange_ApplyStyle_" data-uid="C1.Win.C1Editor.C1TextRange.ApplyStyle*">ApplyStyle Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Win_C1Editor_C1TextRange_ApplyStyle_" data-uid="C1.Win.C1Editor.C1TextRange.ApplyStyle*"></a>
<h4 id="C1_Win_C1Editor_C1TextRange_ApplyStyle_System_String_System_String_" data-uid="C1.Win.C1Editor.C1TextRange.ApplyStyle(System.String,System.String)">ApplyStyle(string, string)</h4>
<div class="markdown level1 summary"><p>Applies specified inline style to the 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 ApplyStyle(string propertyName, string propertyValue)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub ApplyStyle(propertyName As String, propertyValue 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">propertyName</span></td>
      <td><p>Name of CSS property.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">propertyValue</span></td>
      <td><p>CSS value.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Win_C1Editor_C1TextRange_ApplyStyle_System_String_System_String__examples">Examples</h5>
<p>This example converts a Color value to a CSS value and sets it
as the background color of the selected range.
<pre><code class="lang-csharp">string htmlColor = ColorTranslator.ToHtml(value);
c1Editor1.Selection.ApplyStyle(&quot;background-color&quot;, htmlColor);</code></pre>



<a id="C1_Win_C1Editor_C1TextRange_ApplyStyle_" data-uid="C1.Win.C1Editor.C1TextRange.ApplyStyle*"></a>
<h4 id="C1_Win_C1Editor_C1TextRange_ApplyStyle_System_String_System_String_C1_Win_C1Editor_C1StyleType_" data-uid="C1.Win.C1Editor.C1TextRange.ApplyStyle(System.String,System.String,C1.Win.C1Editor.C1StyleType)">ApplyStyle(string, string, C1StyleType)</h4>
<div class="markdown level1 summary"><p>Applies specified inline style to the 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 ApplyStyle(string propertyName, string propertyValue, C1StyleType type)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub ApplyStyle(propertyName As String, propertyValue 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">propertyName</span></td>
      <td><p>Name of CSS property.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">propertyValue</span></td>
      <td><p>CSS value.</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 inline style must be applied.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
