ITextRange.SetIndex(TextRangeUnit, Int32, Boolean) Method

Definition

Moves the text range to the specified unit of the story.

public:
 void SetIndex(TextRangeUnit unit, int index, bool extend);
void SetIndex(TextRangeUnit const& unit, int const& index, bool const& extend);
public void SetIndex(TextRangeUnit unit, int index, bool extend);
function setIndex(unit, index, extend)
Public Sub SetIndex (unit As TextRangeUnit, index As Integer, extend As Boolean)

Parameters

unit
TextRangeUnit

The unit used to move the text range.

index
Int32

int

The index of the specified unit. The text range is relocated to the unit that has this index. If unit is positive, the numbering of units begins at the start of the story and proceeds forward. If negative, the numbering begins at the end of the story and proceeds backward. The start of the story corresponds to index = 1 for all existing units, and the last unit in the story corresponds to index = – 1.

extend
Boolean

bool

Indicates how to change the text range. True extends the text range to include the unit by moving only the end position of the text range. False collapses the text range to an insertion point and then moves the insertion point. The default value is false.

Remarks

This method allows an app to work with line-oriented text, such as source code listings, in a convenient way. For example, ITextRange.SetIndex(Line, 10, 0) converts the text range to an insertion point at the start of the tenth line.

Applies to

See also