Click or drag to resize
TextRangeStartOf Method
Moves the range ends to the start of the first overlapping Unit in the range.

Namespace: TextObjectModel
Assembly: ManagedTOM2 (in ManagedTOM2.dll) Version: 1.0.5577.41188
Syntax
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: Int32
The 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:
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