
An instance of the TextFrameCollection class contains all text frames in a Text Control document or part of the document represented through objects of the type TextFrame. An instance of this class can be obtained with the TextControl.TextFrames or the HeaderFooter.TextFrames property. The TextFrameCollection class implements the IEnumerable and the ICollection interfaces.
Introduced: 12.0.
[C#]
public sealed class TextFrameCollection: ICollection, IEnumerable
[Visual Basic]
Public NotInheritable Class TextFrameCollection
Implements ICollection
Implements IEnumerable
| Property | Description | |
| Count | Gets the number of elements contained in the collection. |
| Method | Description | |
| Add | Inserts a new text frame in a Text Control document. | |
| Clear | Removes all text frames from a Text Control document. | |
| CopyTo | Copies the elements of the collection to an array, starting at a particular index. | |
| DeactivateItem | Deactivates the activated text frame and sets the input focus back to the text part that contains the text frame. | |
| GetEnumerator | Returns an enumerator that can be used to iterate through the collection. | |
| GetItem | Gets a particular text frame from the collection. | |
| Remove | Removes a text frame from a Text Control document. |
The following example checks all text frames in the collection and adds text field if the back color is blue:
[C#]
foreach (TXTextControl.TextFrame myFrame in textControl1.TextFrames)
{
if (myFrame.BackColor == Color.Blue)
{
myFrame.TextFields.Add(new TXTextControl.TextField("Text field"));
}
}
[Visual Basic]
For Each MyFrame As TXTextControl.TextFrame In TextControl1.TextFrames
If MyFrame.BackColor = Color.Blue Then
MyFrame.TextFields.Add(New TXTextControl.TextField("Text field"))
End If
Next