TX Text Control .NET for Windows Forms Documentation

TextPartCollection Class

An instance of the TextPartCollection class contains all text parts in a TX Text Control document. A text part can either be the document's main text, a text frame or a header or footer. A text frame is represented through a TextFrame object, a header or footer through a HeaderFooter object and the document's main text is represented through a MainText object. A TextPartCollection object contains all these objects in a geometric order. The first object in the collection is the main text, followed by all text frames in geometric order. At the end of the collection all headers and footers are contained also geometrically ordered. All objects in a text part collection implement the IFormattedText interface. The collection can be obtained with the TextControl.TextParts, WPF.TextControl.TextParts or ServerTextControl.TextParts property. The TextPartCollection class implements the IEnumerable and the ICollection interfaces.

Introduced: 16.0.

Syntax

[C#] public class TextPartCollection : ICollection, IEnumerable
[Visual Basic] Public Class TextPartCollection Implements ICollection Implements IEnumerable

Properties

PropertyDescription
CountGets the number of elements contained in the collection.

Methods

MethodDescription
ActivateSets the input focus to the specified text part.
CopyToCopies the elements of the collection to an array, starting at a particular index.
GetEnumeratorReturns an enumerator that can be used to iterate through the collection.
GetItemGets the activated text part from the collection, which is the text part with the input focus.
GetMainTextGets the main text part of the document.

Example

The following example shows how to loop through all text parts a get the first line of each part.

[C#] foreach (object obj in textControl1.TextParts) { Console.WriteLine("First Line: " + ((IFormattedText)obj).Lines[1].Text); }

See Also

 
 
 

Products

Support

Downloads

Corporate

Buy Now