| TextRangeStartOf Method |
Moves the range ends to the start of the first overlapping Unit in the range.
Namespace: TextObjectModelAssembly: ManagedTOM2 (in ManagedTOM2.dll) Version: 1.0.5577.41188
Syntax public int StartOf(
TextUnit unit,
RangeShiftType extend
)
Public Function StartOf (
unit As TextUnit,
extend As RangeShiftType
) As Integer
public:
int StartOf(
TextUnit unit,
RangeShiftType extend
)
Parameters
- unit
- Type: TextObjectModelTextUnit
Unit to use in the move operation. - extend
- Type: TextObjectModelRangeShiftType
How to move the ends of the range.
Return Value
Type:
Int32The number of characters that the start position is moved.
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