# C1.WPF.RichTextBox.EditExtensions.ReplaceText

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_WPF_RichTextBox_EditExtensions_ReplaceText_" data-uid="C1.WPF.RichTextBox.EditExtensions.ReplaceText*">ReplaceText Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_WPF_RichTextBox_EditExtensions_ReplaceText_" data-uid="C1.WPF.RichTextBox.EditExtensions.ReplaceText*"></a>
<h4 id="C1_WPF_RichTextBox_EditExtensions_ReplaceText_C1_WPF_RichTextBox_Documents_C1TextRange_System_String_C1_WPF_RichTextBox_Documents_C1Run_" data-uid="C1.WPF.RichTextBox.EditExtensions.ReplaceText(C1.WPF.RichTextBox.Documents.C1TextRange,System.String,C1.WPF.RichTextBox.Documents.C1Run)">ReplaceText(C1TextRange, string, C1Run)</h4>
<div class="markdown level1 summary"><p>Replaces a range with text.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">[Obsolete(&quot;Use the overload without the styledRun parameter&quot;)]
public static C1TextRange ReplaceText(C1TextRange range, string text, C1Run styledRun)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">&lt;Obsolete(&quot;Use the overload without the styledRun parameter&quot;)&gt;
Public Shared Function ReplaceText(range As C1TextRange, text As String, styledRun As C1Run) As C1TextRange</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="C1.WPF.RichTextBox.Documents.C1TextRange.html">C1TextRange</a></td>
      <td><span class="parametername">range</span></td>
      <td><p>A <a class="xref" href="C1.WPF.RichTextBox.Documents.C1TextRange.html">C1TextRange</a>.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">text</span></td>
      <td><p>A string with the text to insert.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.WPF.RichTextBox.Documents.C1Run.html">C1Run</a></td>
      <td><span class="parametername">styledRun</span></td>
      <td><p>A pre styled <a class="xref" href="C1.WPF.RichTextBox.Documents.C1Run.html">C1Run</a> to use when inserting the text. May be null.</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="C1.WPF.RichTextBox.Documents.C1TextRange.html">C1TextRange</a></td>
      <td><p>A range that bounds the inserted text.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_WPF_RichTextBox_EditExtensions_ReplaceText_" data-uid="C1.WPF.RichTextBox.EditExtensions.ReplaceText*"></a>
<h4 id="C1_WPF_RichTextBox_EditExtensions_ReplaceText_C1_WPF_RichTextBox_Documents_C1TextRange_System_String_" data-uid="C1.WPF.RichTextBox.EditExtensions.ReplaceText(C1.WPF.RichTextBox.Documents.C1TextRange,System.String)">ReplaceText(C1TextRange, string)</h4>
<div class="markdown level1 summary"><p>Replaces a range with text.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static C1TextRange ReplaceText(C1TextRange range, string text)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function ReplaceText(range As C1TextRange, text As String) As C1TextRange</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="C1.WPF.RichTextBox.Documents.C1TextRange.html">C1TextRange</a></td>
      <td><span class="parametername">range</span></td>
      <td><p>A <a class="xref" href="C1.WPF.RichTextBox.Documents.C1TextRange.html">C1TextRange</a>.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">text</span></td>
      <td><p>A string with the text to insert.</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="C1.WPF.RichTextBox.Documents.C1TextRange.html">C1TextRange</a></td>
      <td><p>A range that bounds the inserted text.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
