Class TextContentElement
Represents the base class for all text content elements in the content model.
Implements
Inherited Members
Namespace: IronWord.Models.Abstract
Assembly: IronWord.dll
Syntax
public abstract class TextContentElement : ContentElement, IDocumentElement, IDocumentObject, ICloneable, ITextContentElement
Constructors
TextContentElement()
Initializes a new instance of the TextContentElement.
Declaration
protected TextContentElement()
Properties
Style
style for newly added text.
Declaration
public TextStyle Style { get; set; }
Property Value
| Type | Description |
|---|---|
| TextStyle |
Text
Gets or sets the text content of the Run.
Declaration
public string Text { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Methods
Find(String, Nullable<RegexOptions>, Boolean, Boolean)
Finds the indices of the specified search text within the text.
Declaration
public List<int> Find(string searchText, Nullable<RegexOptions> regexOption = null, bool wholeWordOnly = false, bool caseSensitive = false)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | searchText | The text to search for. |
| System.Nullable<System.Text.RegularExpressions.RegexOptions> | regexOption | Optional. The regular expression options. |
| System.Boolean | wholeWordOnly | Optional. Indicates whether to match the whole word only. |
| System.Boolean | caseSensitive | Optional. Indicates whether the search is case-sensitive. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.List<System.Int32> | A list of indices where the search text is found. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | Thrown when |
Replace(String, String, Nullable<RegexOptions>, Boolean, Boolean)
Finds and replaces text within this TextContentElement.
Declaration
public ITextContentElement Replace(string searchText, string replaceText, Nullable<RegexOptions> regexOption = null, bool wholeWordOnly = false, bool caseSensitive = false)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | searchText | The text to search for. |
| System.String | replaceText | The text to replace with. |
| System.Nullable<System.Text.RegularExpressions.RegexOptions> | regexOption | Optional regex options |
| System.Boolean | wholeWordOnly | Replace whole words only |
| System.Boolean | caseSensitive | Whether the search is case-sensitive |
Returns
| Type | Description |
|---|---|
| ITextContentElement |
ToString()
Provides a textual representation of the TextContentElement.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| System.String | A string representation of the element. |