Udostępnij za pośrednictwem


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);
int GetIndex(TextRangeUnit const& unit);
public int GetIndex(TextRangeUnit unit);
function getIndex(unit)
Public Function GetIndex (unit As TextRangeUnit) As Integer

Parameters

unit
TextRangeUnit

The text unit that is indexed.

Returns

Int32

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.

Applies to

See also