In TX Text Control, a document consists of separate text areas such as main text, headers, footers and text frames. Each of these areas have their own collections for contained elements such as lines, images, fields or the TXTextControl.Selection class TX Text Control .NET for Windows Forms
TXTextControl Namespace
Selection Class
The Selection class describes and handles the attributes of a text selection.
object.

In order to manipulate the text in a TXTextControl.HeaderFooter class TX Text Control .NET for Windows Forms
TXTextControl Namespace
HeaderFooter Class
An instance of the HeaderFooter class represents a header or footer in a Text Control document.
object, you would need to access the TXTextControl.HeaderFooter.Selection property TX Text Control .NET for Windows Forms
TXTextControl Namespace
HeaderFooter Class
Selection Property
Gets or sets the current selection in a header or footer.
. To manipulate text in all headers and footers, you would need to loop through all available objects.

To avoid that, we implemented the "meta" collection TXTextControl.TextPartCollection class TX Text Control .NET for Windows Forms
TXTextControl Namespace
TextPartCollection Class
An instance of the TextPartCollection class contains all text parts in a TX Text Control document.
. An instance of this class contains all text parts in a TX Text Control document. Each text part of a document is implemented as an IFormattedText TX Text Control .NET for Windows Forms
TXTextControl Namespace
IFormattedText Interface Interface
The IFormattedText interface contains properties and methods common to all text parts in a TX Text Control document.
interface. The IFormattedText interface contains properties and methods common to all text parts in a TX Text Control document.

In order to set text to the beginning of each text part in the complete document, the following code can be used:

foreach (IFormattedText ftTextPart in textControl1.TextParts)
{
ftTextPart.Selection.Start = 0;
ftTextPart.Selection.Text = "TX Text Control";
}
view raw tx.cs hosted with ❤ by GitHub

This method is very handy to access all ApplicationFields TX Text Control .NET for Windows Forms
TXTextControl Namespace
TextControl Class
ApplicationFields Property
Gets a collection of all application fields contained in the text part with the input focus.
in a document:

foreach (IFormattedText ftTextPart in textControl1.TextParts)
{
foreach (ApplicationField field in ftTextPart.ApplicationFields)
{
field.Text = "Test";
}
}
view raw tx.cs hosted with ❤ by GitHub