ITextRange::SetIndex method

Changes this range to the specified unit of the story.

Syntax


HRESULT SetIndex(
  [in]  long Unit,
  [in]  long Index,
  [in]  long Extend
);

Parameters

Unit [in]

Type: long

Unit used to index the range. For a list of unit values, see ITextRange.

Index [in]

Type: long

Index for the Unit. This range is relocated to the Unit that has this index number. If 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 an Index of 1 for all units that exist, and the last unit in the story corresponds to an Index of -1.

Extend [in]

Type: long

Flag that indicates the extent of the range. If zero (the default), the range is collapsed to an insertion point at the start position of the specified Unit. If nonzero, the range is set to the entire Unit.

Return value

Type: HRESULT

The method returns an HRESULT value. If the method succeeds, it returns S_OK. If the method fails, it returns one of the following error codes. For more information about COM error codes, see Error Handling in COM.

Return codeDescription
E_INVALIDARG

Index is not valid.

E_NOTIMPL

Unit is not supported.

S_FALSE

Failure for some other reason.

 

Remarks

This method allows an application to work with line-oriented text, such as programs, in a convenient way. For example, SetIndex(tomLine, 10, 0) converts a range to an insertion point at the start of the tenth line.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Tom.h

DLL

Msftedit.dll

See also

Reference
ITextRange
Conceptual
Text Object Model

 

 

Community Additions

ADD
Show:
© 2014 Microsoft