Udostępnij za pośrednictwem


Właściwość DocumentBase.Indexes —

Pobiera Indexes , która reprezentuje wszystkie indeksy w dokumencie.

Przestrzeń nazw:  Microsoft.Office.Tools.Word
Zestaw:  Microsoft.Office.Tools.Word.v4.0.Utilities (w Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Składnia

'Deklaracja
Public ReadOnly Property Indexes As Indexes
public Indexes Indexes { get; }

Wartość właściwości

Typ: Microsoft.Office.Interop.Word.Indexes
Indexes , Która reprezentuje wszystkie indeksy w dokumencie.

Przykłady

Poniższy przykład kodu dodaje tekstu do akapitu pierwszego i wstawia pozycję indeksu.Następnie kod dodaje indeks do drugiego akapitu.Aby wykorzystać ten przykład, należy uruchomić go z ThisDocument klasy w projekcie na poziomie dokumentu.

Private Sub DocumentIndexes()

    Me.Paragraphs(1).Range.Text = "This is sample text." & vbLf
    Dim entry As Object = Me.Paragraphs(1).Range.Text
    Dim headingSeparator As Object = False

    Me.Indexes.MarkEntry(Me.Paragraphs(1).Range, entry)

    Dim Type As Object = Word.WdIndexType.wdIndexRunin
    Me.Indexes.Add(Me.Paragraphs(2).Range, headingSeparator, , Type)

End Sub 
private void DocumentIndexes()
{

    this.Paragraphs[1].Range.Text = "This is sample text." + "\n";
    object entry = this.Paragraphs[1].Range.Text;
    object headingSeparator = false;

    this.Indexes.MarkEntry(this.Paragraphs[1].Range,
        ref entry, ref missing, ref missing, ref missing,
        ref missing, ref missing, ref missing, ref missing);


    object Type = Word.WdIndexType.wdIndexRunin;
    this.Indexes.Add(this.Paragraphs[2].Range, 
        ref headingSeparator, ref missing, ref Type,
        ref missing, ref missing, ref missing, 
        ref missing);
}

Zabezpieczenia programu .NET Framework

Zobacz też

Informacje

DocumentBase Klasa

Przestrzeń nazw Microsoft.Office.Tools.Word