ITextRange.GetIndex(TextRangeUnit) ITextRange.GetIndex(TextRangeUnit) ITextRange.GetIndex(TextRangeUnit) ITextRange.GetIndex(TextRangeUnit) Method

Definition

Retrieves the story index of the text unit (word, line, sentence, paragraph, and so on) at the starting character position of the text range.

public : int GetIndex(TextRangeUnit unit)
int32_t GetIndex(TextRangeUnit unit) const;
public int GetIndex(TextRangeUnit unit)
Public Function GetIndex(unit As TextRangeUnit) As int

Parameters

unit
TextRangeUnit TextRangeUnit

The text unit that is indexed.

Returns

int int

The index value. The value is zero if unit does not exist.

Remarks

The first unit in a story has an index value of 1. The index of a unit is the same for all character positions from the position immediately preceding the unit, up to the last character in the unit.

For a text range at the end of a story, the index retrieved by GetIndex indicates the number of units in the story, such as the number of words, lines, objects, and so on.

The index value returned by the GetIndex method is not valid if the text is subsequently edited. Be careful when using retrieved index values, especially if you store the values for a significant length of time.

See also