Share via


TextRange2.Runs Property

Gets the specified subset of text runs. A text run consists of a range of characters that share the same font attributes. Read-only.

Namespace:  Microsoft.Office.Core
Assembly:  office (in office.dll)

Syntax

'Declaration
ReadOnly Property Runs ( _
    Start As Integer, _
    Length As Integer _
) As TextRange2
    Get
'Usage
Dim instance As TextRange2
Dim Start As Integer
Dim Length As Integer
Dim value As TextRange2

value = instance.Runs(Start, Length)
TextRange2 this[
    int Start,
    int Length
] { get; }

Parameters

  • Start
    Type: System.Int32

    The first run in the returned range.

  • Length
    Type: System.Int32

    The number of runs to be returned.

Property Value

Type: Microsoft.Office.Core.TextRange2
TextRange2

Remarks

If both Start and Length are omitted, the returned range starts with the first run and ends with the last paragraph in the specified range.

If Start is specified but Length is omitted, the returned range contains one run.

If Length is specified but Start is omitted, the returned range starts with the first run in the specified range.

If Start is greater than the number of runs in the specified text, the returned range starts with the last run in the specified range.

If Length is greater than the number of runs from the specified starting run to the end of the text, the returned range contains all those runs.

A run consists of all characters from the first character after a font change to the second-to-last character with the same font attributes. For example, consider the following sentence:

This italic word is not bold.

In the preceding sentence, the first run consists of the word "This" only if the space after the word "This" isn't formatted as italic (if the space is italic, the first run is only the first three characters, or "Thi"). Likewise, the second run contains the word "italic" only if the space after the word is formatted as italic.

See Also

Reference

TextRange2 Interface

TextRange2 Members

Microsoft.Office.Core Namespace