Class FormattedText
Represents formatted text in a Shape.
Inheritance
FormattedText
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
BodyEffects
Gets the effects applied to the text body.
Declaration
public virtual TextBodyEffects BodyEffects { get; }
Property Value
ColumnNumber
Gets or sets the number of text columns.
Declaration
public virtual int ColumnNumber { get; set; }
Property Value
ColumnSpacing
Gets or sets the spacing between text columns in points.
Declaration
public virtual double ColumnSpacing { get; set; }
Property Value
CustomAngle
Gets or sets the optional text rotation angle in degrees.
Declaration
public virtual int? CustomAngle { get; set; }
Property Value
Font
Gets or sets the default font used for newly created text runs.
Declaration
public virtual DrawingFont Font { get; protected set; }
Property Value
Format
Provides a GemBox-compatible formatting surface for text-body settings.
Declaration
public FormattedTextFormat Format { get; }
Property Value
Margin
Gets or sets the text margins in points.
Declaration
public virtual Margin Margin { get; protected set; }
Property Value
Paragraphs
Gets the live paragraphs that make up this text body.
Declaration
public virtual ParagraphCollection Paragraphs { get; protected set; }
Property Value
ResizeShapeToFitText
Gets or sets whether the owning shape resizes to fit its text.
Declaration
public virtual bool ResizeShapeToFitText { get; set; }
Property Value
Text
Gets or replaces the flattened text content of this text body.
Declaration
public virtual string Text { get; set; }
Property Value
TextDirection
Gets or sets the direction in which text is laid out.
Declaration
public TextDirection TextDirection { get; set; }
Property Value
VerticalAlignment
Gets or sets the vertical alignment of the text within its shape.
Declaration
public virtual TextBoxVerticalAlignment VerticalAlignment { get; set; }
Property Value
WrapText
Gets or sets whether text wraps within the shape.
Declaration
public virtual bool WrapText { get; set; }
Property Value
Methods
AddParagraph()
Adds a new paragraph to this text body and returns it.
Declaration
public DrawingTextParagraph AddParagraph()
Returns
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
FindAll(string, TextSearchOptions)
Declaration
public IReadOnlyList<TextRange> FindAll(string searchText, TextSearchOptions options)
Parameters
Returns
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
Returns
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
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
Returns
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
Returns
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
Returns
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
Returns
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
Returns
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.
|