TextElementCollection Class
Represents a collection of TextElements.
public class TextElementCollection : IEnumerable<TextElement>, IEnumerable
Public Class TextElementCollection
Implements IEnumerable(Of TextElement), IEnumerable
- Inheritance:
- System.ObjectTextElementCollection
Properties
Count
Gets the number of TextElements contained in the collection.
Property Value
- System.Int32
The number of TextElements contained in the collection.
Item[Int32]
Gets or sets the TextElement at the specified index.
public TextElement this[int index] { get; }
Public ReadOnly Property Item(index As Integer) As TextElement
Parameters
index
- System.Int32
Property Value
The TextElement at the specified index.
Exceptions
- System.ArgumentOutOfRangeException
index
is less than zero or index
is equal to or greater than Count.
Methods
AddLineBreak()
Adds a new line break to the paragraph.
Returns
The line break added to the paragraph.
AddRun(String)
Adds a new run of text to the paragraph.
Parameters
text
- System.String
The text.
Returns
The run of text added to the paragraph.
Exceptions
- System.ArgumentException
Parameter text
is either null or System.String.Empty, or it contains character '\v', '\r' or '\n'. Character '\v' represents a line break and a TextLineBreak instance should be added instead. Characters '\r' and '\n' represent a paragraph break and a TextParagraph instance should be added instead.
Clear()
Removes all TextElements from the collection.
Contains(TextElement)
Determines whether a TextElement is in the collection.
public bool Contains(TextElement item)
Public Function Contains(item As TextElement) As Boolean
Parameters
item
- TextElement
The TextElement to locate in the collection.
Returns
- System.Boolean
true if item
is found in the collection; otherwise, false.
Exceptions
- System.ArgumentNullException
item
is null.
GetEnumerator()
Returns an enumerator that iterates through the TextElementCollection.
public IEnumerator<TextElement> GetEnumerator()
Public Function GetEnumerator As IEnumerator(Of TextElement)
Returns
- System.Collections.Generic.IEnumerator<TextElement>
An System.Collections.Generic.IEnumerator<T> for the collection.
IndexOf(TextElement)
Searches for the specified TextElement and returns the zero-based index of the first occurrence within the entire collection.
Parameters
item
- TextElement
The TextElement to locate in the collection.
Returns
- System.Int32
The zero-based index of the first occurrence of item
within the entire collection, if found; otherwise, -1.
Remove(TextElement)
Removes the first occurrence of a specific TextElement from the collection.
Parameters
item
- TextElement
The TextElement to remove from the collection.
Returns
- System.Boolean
true if item
is successfully removed; otherwise, false. This method also returns false if item
was not found in the original collection.
RemoveAt(Int32)
Removes the TextElement at the specified index of the collection.
Parameters
index
- System.Int32
The zero-based index of the TextElement to remove.
Exceptions
- System.ArgumentOutOfRangeException
index
is less than zero or index
is equal to or greater than Count.