Interface IWordTextObject
Text object from a Word document
Namespace: IronWord.Models
Assembly: IronWord.dll
Syntax
public interface IWordTextObject
Reading or editing a run of text already in a Word document in C# runs through IWordTextObject. The contract represents a single text element a document contains, so code that walks or rewrites content can treat every piece of text uniformly rather than binding to one concrete class. It composes the shared text, document-object, cloning, and serialization abstractions, which together expose the text content, its identity in the document, and its ability to be copied and round-tripped.
The concrete implementor in IronWord is TextContent, the type code receives when it reaches text while traversing a document. Most code names TextContent directly; the interface matters when a method accepts or returns text by contract, which keeps editing routines decoupled from how the text was originally written. Because IWordTextObject extends ICloneable, an implementation can be duplicated, and because it extends the serialization abstraction, it persists with the document model. Work through the contract when a routine should accept any document text regardless of its source.
The edit text how-to rewrites existing text, and the add text how-to writes new content.