Sdílet prostřednictvím


DocumentBase.Indexes Property

Definition

Gets an Indexes collection that represents all the indexes in the document.

public:
 property Microsoft::Office::Interop::Word::Indexes ^ Indexes { Microsoft::Office::Interop::Word::Indexes ^ get(); };
public Microsoft.Office.Interop.Word.Indexes Indexes { get; }
member this.Indexes : Microsoft.Office.Interop.Word.Indexes
Public ReadOnly Property Indexes As Indexes

Property Value

An Indexes collection that represents all the indexes in the document.

Examples

The following code example adds text to the first paragraph and inserts an index entry. The code then adds an index to the second paragraph. To use this example, run it from the ThisDocument class in a document-level project.

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);
}
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 

Applies to