ITextRange.EndOf(TextRangeUnit, Boolean) Method

Definition

Moves or extends the text range to the end of the nearest specified text unit. The text range is moved or extended forward in the document.

public:
 int EndOf(TextRangeUnit unit, bool extend);
int EndOf(TextRangeUnit const& unit, bool const& extend);
public int EndOf(TextRangeUnit unit, bool extend);
function endOf(unit, extend)
Public Function EndOf (unit As TextRangeUnit, extend As Boolean) As Integer

Parameters

unit
TextRangeUnit

The unit by which to move the end position of the text range.

extend
Boolean

bool

True extends the text range by moving just the end position of the range to the end of the specified unit. False moves both ends of the text range to the end of the specified unit. The default value is false.

Returns

Int32

int

The number of character positions that the range was moved or extended, plus 1 if the text range collapsed to the start of the range. If the text range includes the final carriage return (CR) at the end of the story, and extend is false, the return value is set to –1 to indicate that the collapse occurred before the end of the range. This is because an insertion point cannot exist beyond the final CR.

Remarks

If the range is an insertion point on a boundary between units, the EndOf method does not change the end position of the range.

Applies to