TablesOfContents.Add Method

Returns a TableOfContents object that represents a table of contents added to a document.

Namespace:  Microsoft.Office.Interop.Word
Assembly:  Microsoft.Office.Interop.Word (in Microsoft.Office.Interop.Word.dll)

Syntax

'Declaration
Function Add ( _
    Range As Range, _
    ByRef UseHeadingStyles As Object, _
    ByRef UpperHeadingLevel As Object, _
    ByRef LowerHeadingLevel As Object, _
    ByRef UseFields As Object, _
    ByRef TableID As Object, _
    ByRef RightAlignPageNumbers As Object, _
    ByRef IncludePageNumbers As Object, _
    ByRef AddedStyles As Object, _
    ByRef UseHyperlinks As Object, _
    ByRef HidePageNumbersInWeb As Object, _
    ByRef UseOutlineLevels As Object _
) As TableOfContents
'Usage
Dim instance As TablesOfContents
Dim Range As Range
Dim UseHeadingStyles As Object
Dim UpperHeadingLevel As Object
Dim LowerHeadingLevel As Object
Dim UseFields As Object
Dim TableID As Object
Dim RightAlignPageNumbers As Object
Dim IncludePageNumbers As Object
Dim AddedStyles As Object
Dim UseHyperlinks As Object
Dim HidePageNumbersInWeb As Object
Dim UseOutlineLevels As Object
Dim returnValue As TableOfContents

returnValue = instance.Add(Range, UseHeadingStyles, _
    UpperHeadingLevel, LowerHeadingLevel, _
    UseFields, TableID, RightAlignPageNumbers, _
    IncludePageNumbers, AddedStyles, _
    UseHyperlinks, HidePageNumbersInWeb, _
    UseOutlineLevels)
TableOfContents Add(
    Range Range,
    ref Object UseHeadingStyles,
    ref Object UpperHeadingLevel,
    ref Object LowerHeadingLevel,
    ref Object UseFields,
    ref Object TableID,
    ref Object RightAlignPageNumbers,
    ref Object IncludePageNumbers,
    ref Object AddedStyles,
    ref Object UseHyperlinks,
    ref Object HidePageNumbersInWeb,
    ref Object UseOutlineLevels
)

Parameters

  • Range
    Type: Microsoft.Office.Interop.Word.Range
    Required Range object. The range where you want the table of contents to appear. The table of contents replaces the range if the range isn't collapsed.
  • UseHeadingStyles
    Type: System.Object%
    Optional Object. True to use built-in heading styles to create the table of contents. The default value is True.
  • UpperHeadingLevel
    Type: System.Object%
    Optional Object. The starting heading level for the table of contents. Corresponds to the starting value used with the \o switch for a Table of Contents (TOC) field. The default value is 1.
  • LowerHeadingLevel
    Type: System.Object%
    Optional Object. The ending heading level for the table of contents. Corresponds to the ending value used with the \o switch for a Table of Contents (TOC) field. The default value is 9.
  • UseFields
    Type: System.Object%
    Optional Object. True if Table of Contents Entry (TC) fields are used to create the table of contents. Use the MarkEntry method to mark entries to be included in the table of contents. The default value is False.
  • TableID
    Type: System.Object%
    Optional Object. A one-letter identifier that's used to build a table of contents from TC fields. Corresponds to the \f switch for a Table of Contents (TOC) field. For example, "T" builds a table of contents from TC fields using the table identifier T. If this argument is omitted, TC fields aren't used.
  • RightAlignPageNumbers
    Type: System.Object%
    Optional Object. True if page numbers in the table of contents are aligned with the right margin. The default value is True.
  • IncludePageNumbers
    Type: System.Object%
    Optional Object. True to include page numbers in the table of contents. The default value is True.
  • AddedStyles
    Type: System.Object%
    Optional Object. The string name for additional styles used to compile the table of contents (styles other than the Heading 1 – Heading 9 styles). Use the Add method of a HeadingStyles object to create new heading styles.
  • UseHyperlinks
    Type: System.Object%
    Optional Object. True if entries in a table of contents should be formatted as hyperlinks when the document is being publishing to the Web. The default value is True.
  • HidePageNumbersInWeb
    Type: System.Object%
    Optional Object. True to use outline levels to create the table of contents. The default is False.
  • UseOutlineLevels
    Type: System.Object%
    Optional Object. True to use outline levels to create the table of contents. The default is False.

Return Value

Type: Microsoft.Office.Interop.Word.TableOfContents

See Also

Reference

TablesOfContents Interface

TablesOfContents Members

Microsoft.Office.Interop.Word Namespace