VDocs.NET
Back to DOM

DOM.Elements.TextElements.Text

Namespace: DOM.Elements.TextElements

Represents a text within the document model. Anode holds plain textual content and an optional text style, and can participate in search, replace, and other text-processing operations.

6 members

Constructors

Text

2 overloads
Text()

Initializes a new instance of theclass with empty content.

Text(string text)

Initializes a new instance of theclass with the specified content.

Parameters

text
The initial text to populate the content with.

Properties

Content

Gets or sets the literal textual content contained in this text run.

Style

Gets or sets the style applied to this text run. The style defines font characteristics such as size, weight, color, and other inline formatting properties.

Methods

Find

Find(string searchText, RegexOptions? regexOption, bool wholeWordOnly, bool caseSensitive)

Finds all occurrences of the specified search text within the current text content. Supports optional regular expression behavior, whole-word matching, and case-sensitivity controls. Returns a list of character indices where matches occur.

Parameters

searchText
The text to search for. Cannot be null.
regexOption
Optional to apply.
wholeWordOnly
When, the match must correspond to a complete whole word boundary.
caseSensitive
When, the search is case-sensitive; otherwise performed case-insensitively.

Returns

A list of integer indices representing the starting positions of each match.

Exceptions

  • System.ArgumentNullException: Thrown whenis null.

Replace

IText Replace(string searchText, string replaceText, RegexOptions? regexOption, bool wholeWordOnly, bool caseSensitive)

Replaces occurrences of the specified search text within the current text content. Supports optional regular expression behavior, whole-word matching, and case-sensitivity controls.

Parameters

searchText
The text to search for. Cannot be null.
replaceText
The replacement text to substitute in matched positions.
regexOption
Optional to apply.
wholeWordOnly
When, the match must correspond to a complete whole word boundary.
caseSensitive
When, the search is case-sensitive; otherwise performed case-insensitively.

Returns

IText

Returns the currentinstance to allow fluent chaining.

Exceptions

  • System.ArgumentNullException: Thrown whenis null.
VDocs.NET
The .NET Word Document Library

Generate Word
documents.
Not XML.

Create professional documents in .NET without the complexity of OpenXML or Word Interop.

C#VB.NET
var doc = new WordDocument();

doc.AddParagraph()
   .AddText("Invoice")
   .SetHeading(HeadingLevel.Title);

doc.Save("invoice.docx");

Create Account

Create your VDocs account.

or

Already have an account? Sign in