• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support
Show / Hide Table of Contents

Class FormattedText

Represents formatted text in a Shape.

Inheritance
object
FormattedText
TextFrame
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: DRIT.Presentation.Drawing
Assembly: DRIT.Presentation.dll
Syntax
public class FormattedText

Properties

AllowTextToOverflowShape

Gets or sets whether text may render beyond the shape bounds.

Declaration
public virtual bool AllowTextToOverflowShape { get; set; }
Property Value
Type Description
bool

BodyEffects

Gets the effects applied to the text body.

Declaration
public virtual TextBodyEffects BodyEffects { get; }
Property Value
Type Description
TextBodyEffects

ColumnNumber

Gets or sets the number of text columns.

Declaration
public virtual int ColumnNumber { get; set; }
Property Value
Type Description
int

ColumnSpacing

Gets or sets the spacing between text columns in points.

Declaration
public virtual double ColumnSpacing { get; set; }
Property Value
Type Description
double

CustomAngle

Gets or sets the optional text rotation angle in degrees.

Declaration
public virtual int? CustomAngle { get; set; }
Property Value
Type Description
int?

Font

Gets or sets the default font used for newly created text runs.

Declaration
public virtual DrawingFont Font { get; protected set; }
Property Value
Type Description
DrawingFont

Format

Provides a GemBox-compatible formatting surface for text-body settings.

Declaration
public FormattedTextFormat Format { get; }
Property Value
Type Description
FormattedTextFormat

Margin

Gets or sets the text margins in points.

Declaration
public virtual Margin Margin { get; protected set; }
Property Value
Type Description
Margin

Paragraphs

Gets the live paragraphs that make up this text body.

Declaration
public virtual ParagraphCollection Paragraphs { get; protected set; }
Property Value
Type Description
ParagraphCollection

ResizeShapeToFitText

Gets or sets whether the owning shape resizes to fit its text.

Declaration
public virtual bool ResizeShapeToFitText { get; set; }
Property Value
Type Description
bool

Text

Gets or replaces the flattened text content of this text body.

Declaration
public virtual string Text { get; set; }
Property Value
Type Description
string

TextDirection

Gets or sets the direction in which text is laid out.

Declaration
public TextDirection TextDirection { get; set; }
Property Value
Type Description
TextDirection

VerticalAlignment

Gets or sets the vertical alignment of the text within its shape.

Declaration
public virtual TextBoxVerticalAlignment VerticalAlignment { get; set; }
Property Value
Type Description
TextBoxVerticalAlignment

WrapText

Gets or sets whether text wraps within the shape.

Declaration
public virtual bool WrapText { get; set; }
Property Value
Type Description
bool

Methods

AddParagraph()

Adds a new paragraph to this text body and returns it.

Declaration
public DrawingTextParagraph AddParagraph()
Returns
Type Description
DrawingTextParagraph

AppendText(string)

Appends text as a new paragraph using the current default font.

Declaration
public void AppendText(string text)
Parameters
Type Name Description
string text

The text to append.

Exceptions
Type Condition
ArgumentNullException

text is null.

FindAll(string, TextSearchOptions)

Finds all occurrences of searchText using the specified TextSearchOptions.

Declaration
public IReadOnlyList<TextRange> FindAll(string searchText, TextSearchOptions options)
Parameters
Type Name Description
string searchText
TextSearchOptions options
Returns
Type Description
IReadOnlyList<TextRange>

FindAll(string, StringComparison)

Finds all occurrences of searchText across all paragraphs and returns them as a read-only list of TextRange values.

Declaration
public IReadOnlyList<TextRange> FindAll(string searchText, StringComparison comparison = StringComparison.Ordinal)
Parameters
Type Name Description
string searchText
StringComparison comparison
Returns
Type Description
IReadOnlyList<TextRange>

FindAll(Regex)

Finds all regular-expression matches across all paragraphs and returns them as a read-only list of TextRange values.

Declaration
public IReadOnlyList<TextRange> FindAll(Regex regex)
Parameters
Type Name Description
Regex regex

The regular expression to match.

Returns
Type Description
IReadOnlyList<TextRange>

A read-only list of matches.

FindFirst(string, StringComparison)

Returns the first occurrence of searchText across all paragraphs, or null if not found.

Declaration
public TextRange FindFirst(string searchText, StringComparison comparison = StringComparison.Ordinal)
Parameters
Type Name Description
string searchText
StringComparison comparison
Returns
Type Description
TextRange

HighlightRegex(Regex, DrawingColor)

Highlights all regular-expression matches with the specified color. Returns the number of highlighted matches.

Declaration
public int HighlightRegex(Regex regex, DrawingColor highlightColor)
Parameters
Type Name Description
Regex regex
DrawingColor highlightColor
Returns
Type Description
int

HighlightText(string, DrawingColor, StringComparison)

Highlights all occurrences of searchText with the specified color. Returns the number of highlighted matches.

Declaration
public int HighlightText(string searchText, DrawingColor highlightColor, StringComparison comparison = StringComparison.Ordinal)
Parameters
Type Name Description
string searchText
DrawingColor highlightColor
StringComparison comparison
Returns
Type Description
int

Replace(string, string, TextSearchOptions)

Replaces every occurrence of oldValue with newValue using the specified TextSearchOptions.

Declaration
public int Replace(string oldValue, string newValue, TextSearchOptions options)
Parameters
Type Name Description
string oldValue
string newValue
TextSearchOptions options
Returns
Type Description
int

Replace(string, string, StringComparison)

Replaces every occurrence of oldValue with newValue across all paragraphs, preserving per-run formatting where possible. Returns the total number of replacements made.

Declaration
public int Replace(string oldValue, string newValue, StringComparison comparison = StringComparison.Ordinal)
Parameters
Type Name Description
string oldValue
string newValue
StringComparison comparison
Returns
Type Description
int

Replace(Regex, string)

Replaces every regular-expression match with replacement across all paragraphs, preserving per-run formatting where possible. Returns the total number of replacements made.

Declaration
public int Replace(Regex regex, string replacement)
Parameters
Type Name Description
Regex regex

The regular expression to match.

string replacement

The replacement string (may include substitution patterns like \(1</code>, <code>\)&).

Returns
Type Description
int

The number of replacements made.

Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX