TablesOfContents.Add Method

Definition

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

public Microsoft.Office.Interop.Word.TableOfContents Add (Microsoft.Office.Interop.Word.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);
abstract member Add : Microsoft.Office.Interop.Word.Range * obj * obj * obj * obj * obj * obj * obj * obj * obj * obj * obj -> Microsoft.Office.Interop.Word.TableOfContents
Public Function Add (Range As Range, Optional ByRef UseHeadingStyles As Object, Optional ByRef UpperHeadingLevel As Object, Optional ByRef LowerHeadingLevel As Object, Optional ByRef UseFields As Object, Optional ByRef TableID As Object, Optional ByRef RightAlignPageNumbers As Object, Optional ByRef IncludePageNumbers As Object, Optional ByRef AddedStyles As Object, Optional ByRef UseHyperlinks As Object, Optional ByRef HidePageNumbersInWeb As Object, Optional ByRef UseOutlineLevels As Object) As TableOfContents

Parameters

Range
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
Object

Optional Object. True to use built-in heading styles to create the table of contents. The default value is True.

UpperHeadingLevel
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
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
Object

Optional Object. True if Table of Contents Entry (TC) fields are used to create the table of contents. Use the MarkEntry(Range, Object, Object, Object, Object) method to mark entries to be included in the table of contents. The default value is False.

TableID
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
Object

Optional Object. True if page numbers in the table of contents are aligned with the right margin. The default value is True.

IncludePageNumbers
Object

Optional Object. True to include page numbers in the table of contents. The default value is True.

AddedStyles
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(Object, Int16) method of a HeadingStyles object to create new heading styles.

UseHyperlinks
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
Object

Optional Object. True to use outline levels to create the table of contents. The default is False.

UseOutlineLevels
Object

Optional Object. True to use outline levels to create the table of contents. The default is False.

Returns

Applies to