ITextRange.SetIndex method

Applies to Windows and Windows Phone

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

Syntax


void SetIndex(
  TextRangeUnit unit, 
  int index, 
  bool extend
)

Parameters

unit

Type: TextRangeUnit

The unit used to move the text range.

index

Type: System.Int32 [.NET] | int32 [C++]

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

Type: System.Boolean [.NET] | Platform::Boolean [C++]

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.

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Text
Windows::UI::Text [C++]

Metadata

Windows.winmd

See also

ITextRange
ITextRange.GetIndex

 

 

Show:
© 2014 Microsoft