DocumentBase.Indexes Property

Definition

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

public Microsoft.Office.Interop.Word.Indexes Indexes { get; }

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

Applies to

Ürün Sürümler
Visual Studio Tools for Office 2017, 2019, 2022