An instance of the LineCollection class contains all text lines in a Text Control document or part of the document represented through objects of the type Line. An instance of this class can be obtained with the TextControl.Lines, HeaderFooter.Lines or TextFrame.Lines property. The LineCollection class implements the IEnumerable and the ICollection interfaces.

Syntax

public class LineCollection : ICollection, IEnumerable
Public Class LineCollection
  Implements ICollection
  Implements IEnumerable

Introduced: 10.1.

Examples

The following example shows how to loop through all lines and how to get the according page number of that line.

foreach (TXTextControl.Line line in textControl1.Lines)
{
    Console.WriteLine("Line " + line.Number.ToString() +
                     " is on page " + line.Page.ToString());
}
For Each line As TXTextControl.Line In TextControl1.Lines
    Console.WriteLine("Line " + line.Number.ToString() _
                     + " is on page " + line.Page.ToString())
Next

Methods

Method Description
CopyTo Copies the elements of the collection to an array, starting at a particular index.
GetEnumerator Returns an enumerator that can be used to iterate through the collection.
GetItem Gets a particular line from the collection.

Properties

Property Description
Count Gets the number of elements contained in the collection.
Item Gets the line from the collection.