Click or drag to resize
TextRangeEndOf Method
Moves this range's ends to the end of the last overlapping unit in the range.

Namespace: TextObjectModel
Assembly: ManagedTOM2 (in ManagedTOM2.dll) Version: 1.0.5577.41188
Syntax
public int EndOf(
	TextUnit unit,
	RangeShiftType extend
)

Parameters

unit
Type: TextObjectModelTextUnit
Unit to use.
extend
Type: TextObjectModelRangeShiftType
Indicator of how the shifting of the range ends is to proceed.

Return Value

Type: Int32
The count of characters that End is moved past.
Examples
The following example demonstrates how to use the StartOf(TextUnit, RangeShiftType) and EndOf(TextUnit, RangeShiftType) methods to move the ends of a range:
C#
void StartOfEndOfExample(TextDocument document) {
    TextRange range = document.EntireRange;
    range.Text = "This is my first. This is my second.";

    range.Collapse(RangePosition.Start);
    range.Move(TextUnit.Character, 8);
    range.EndOf(TextUnit.Sentence, RangeShiftType.Extend);

    // range text is now "my first."
    Console.WriteLine("Range text is now: {0}", range.Text);

    range.StartOf(TextUnit.Sentence, RangeShiftType.Extend);

    // range text is now "This is my first."
    Console.WriteLine("Range text is now: {0}", range.Text);
}
See Also