| TextRangeEndOf Method |
Moves this range's ends to the end of the last overlapping unit in the range.
Namespace: TextObjectModelAssembly: ManagedTOM2 (in ManagedTOM2.dll) Version: 1.0.5577.41188
Syntax public int EndOf(
TextUnit unit,
RangeShiftType extend
)
Public Function EndOf (
unit As TextUnit,
extend As RangeShiftType
) As Integer
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:
Int32The 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:
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);
Console.WriteLine("Range text is now: {0}", range.Text);
range.StartOf(TextUnit.Sentence, RangeShiftType.Extend);
Console.WriteLine("Range text is now: {0}", range.Text);
}
See Also