# GrapeCity.Drawing.IDrawingContext.MeasureText

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_Drawing_IDrawingContext_MeasureText_" data-uid="GrapeCity.Drawing.IDrawingContext.MeasureText*">MeasureText Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_Drawing_IDrawingContext_MeasureText_" data-uid="GrapeCity.Drawing.IDrawingContext.MeasureText*"></a>
<h4 id="GrapeCity_Drawing_IDrawingContext_MeasureText_GrapeCity_Spreadsheet_RichText_GrapeCity_Spreadsheet_Font_GrapeCity_Drawing_Size_System_Boolean_" data-uid="GrapeCity.Drawing.IDrawingContext.MeasureText(GrapeCity.Spreadsheet.RichText,GrapeCity.Spreadsheet.Font,GrapeCity.Drawing.Size,System.Boolean)">MeasureText(RichText, Font, Size, bool)</h4>
<div class="markdown level1 summary"><p>Measure the displayed size of rich text in context.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">Size MeasureText(RichText richText, Font baseFont, Size size, bool wordWrap)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Function MeasureText(richText As RichText, baseFont As Font, size As Size, wordWrap As Boolean) As Size</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="GrapeCity.Spreadsheet.RichText.html">RichText</a></td>
      <td><span class="parametername">richText</span></td>
      <td><p>Rich text content.</p>
</td>
    </tr>
    <tr>
      <td><span class="xref">Font</span></td>
      <td><span class="parametername">baseFont</span></td>
      <td><p>Base font of rich text.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="GrapeCity.Drawing.Size.html">Size</a></td>
      <td><span class="parametername">size</span></td>
      <td><p>The current boundary size.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">wordWrap</span></td>
      <td><p>true if allow word wrap and false for otherwise.</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="GrapeCity.Drawing.Size.html">Size</a></td>
      <td><p>The <a class="xref" href="GrapeCity.Drawing.Size.html">Size</a> represent displayed size of rich text.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Drawing_IDrawingContext_MeasureText_" data-uid="GrapeCity.Drawing.IDrawingContext.MeasureText*"></a>
<h4 id="GrapeCity_Drawing_IDrawingContext_MeasureText_GrapeCity_Drawing_TextDocument_GrapeCity_Drawing_TextFormat_GrapeCity_Drawing_Size_System_Boolean_" data-uid="GrapeCity.Drawing.IDrawingContext.MeasureText(GrapeCity.Drawing.TextDocument,GrapeCity.Drawing.TextFormat,GrapeCity.Drawing.Size,System.Boolean)">MeasureText(TextDocument, TextFormat, Size, bool)</h4>
<div class="markdown level1 summary"><p>Measure the displayed size of rich text in context.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">Size MeasureText(TextDocument text, TextFormat baseFormat, Size size, bool wrapByCharacter = true)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Function MeasureText(text As TextDocument, baseFormat As TextFormat, size As Size, Optional wrapByCharacter As Boolean = True) As Size</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">TextDocument</span></td>
      <td><span class="parametername">text</span></td>
      <td><p>The text document.</p>
</td>
    </tr>
    <tr>
      <td><span class="xref">TextFormat</span></td>
      <td><span class="parametername">baseFormat</span></td>
      <td><p>Base format of rich text.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="GrapeCity.Drawing.Size.html">Size</a></td>
      <td><span class="parametername">size</span></td>
      <td><p>The current boundary size.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">wrapByCharacter</span></td>
      <td><p>Determines how text wraps when wrapping is possible. If true, text wraps at the character level. Wrap by word for otherwise.</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="GrapeCity.Drawing.Size.html">Size</a></td>
      <td><p>The <a class="xref" href="GrapeCity.Drawing.Size.html">Size</a> represent displayed size of rich text.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Drawing_IDrawingContext_MeasureText_" data-uid="GrapeCity.Drawing.IDrawingContext.MeasureText*"></a>
<h4 id="GrapeCity_Drawing_IDrawingContext_MeasureText_System_String_GrapeCity_Spreadsheet_Font_GrapeCity_Drawing_Size_GrapeCity_Drawing_DrawingTextFormat_System_Double_" data-uid="GrapeCity.Drawing.IDrawingContext.MeasureText(System.String,GrapeCity.Spreadsheet.Font,GrapeCity.Drawing.Size,GrapeCity.Drawing.DrawingTextFormat,System.Double)">MeasureText(string, Font, Size, DrawingTextFormat, double)</h4>
<div class="markdown level1 summary"><p>Measure the size of a string in the context.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">Size MeasureText(string str, Font font, Size size, DrawingTextFormat drawingTextFormat = DrawingTextFormat.None, double rotation = 0)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Function MeasureText(str As String, font As Font, size As Size, Optional drawingTextFormat As DrawingTextFormat = DrawingTextFormat.None, Optional rotation As Double = 0) As Size</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">str</span></td>
      <td><p>String content</p>
</td>
    </tr>
    <tr>
      <td><span class="xref">Font</span></td>
      <td><span class="parametername">font</span></td>
      <td><p>Font to measure</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="GrapeCity.Drawing.Size.html">Size</a></td>
      <td><span class="parametername">size</span></td>
      <td><p>The current boundary size.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="GrapeCity.Drawing.DrawingTextFormat.html">DrawingTextFormat</a></td>
      <td><span class="parametername">drawingTextFormat</span></td>
      <td><p><a class="xref" href="GrapeCity.Drawing.DrawingTextFormat.html">DrawingTextFormat</a> structure that specifies the drawing text format.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></td>
      <td><span class="parametername">rotation</span></td>
      <td></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="GrapeCity.Drawing.Size.html">Size</a></td>
      <td><p>The size of displayed string.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
