Using IFormattedText Objects to Access Elements Across All TextParts in a Document
TX Text Control documents contain separate text areas including headers, footers, and text frames. TextPartCollection exposes them all as IFormattedText objects, enabling document-wide operations like modifying selections or retrieving ApplicationFields without looping through each area.

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 TXText
In order to manipulate the text in a TXText
To avoid that, we implemented the "meta" collection TXText
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";
}
This method is very handy to access all Application
foreach (IFormattedText ftTextPart in textControl1.TextParts)
{
foreach (ApplicationField field in ftTextPart.ApplicationFields)
{
field.Text = "Test";
}
}Also See
This post references the following in the documentation:
- TXText
Control. Header Footer Class - TXText
Control. Header Footer. Selection Property - TXText
Control. IFormatted Text Interface - TXText
Control. Selection Class - TXText
Control. Text Control. Application Fields Property - TXText
Control. Text Part Collection Class
Windows Forms
Text Control combines the power of a reporting tool and an easy-to-use WYSIWYG word processor - fully programmable and embeddable in your Windows Forms application. TX Text Control .NET for Windows Forms is a royalty-free, fully programmable rich edit control that offers developers a broad range of word processing features in a reusable component for Visual Studio.
Related Posts
Windows Forms and WPF: End a List on Return when Line is Empty
In TX Text Control, numbered and bulleted lists continue into each new paragraph by default. Handling the KeyPress event and detecting Enter on an empty line allows list formatting to be removed…
TXTextControl.Markdown.Core 34.1.0-beta: Work with Full Documents,…
In this article, we will explore the new features and improvements in TXTextControl.Markdown.Core 34.1.0-beta, including working with full documents, selection, and SubTextParts. We will also…
TX Spell .NET 11.0 SP1 is Now Available: What's New in the Latest Version
TX Spell .NET 11.0 Service Pack 1 is now available, offering important updates and bug fixes for all platforms. If you use TX Spell .NET in your document processing applications, this service pack…
TX Text Control 34.0 SP2 is Now Available: What's New in the Latest Version
TX Text Control 34.0 Service Pack 2 is now available, offering important updates and bug fixes for all platforms. If you use TX Text Control in your document processing applications, this service…
TX Text Control 34.0 SP1 is Now Available: What's New in the Latest Version
TX Text Control 34.0 Service Pack 1 is now available, offering important updates and bug fixes for all platforms. If you use TX Text Control in your document processing applications, this service…
