DocumentBase.Indexes Property
Gets an Indexes collection that represents all the indexes in the document.
Namespace: Microsoft.Office.Tools.Word
Assembly: Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)
Syntax
'Declaration
Public ReadOnly Property Indexes As Indexes
public Indexes Indexes { get; }
Property Value
Type: Microsoft.Office.Interop.Word.Indexes
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 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);
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.