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)
Usage
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
Dim tablesOfContents1 As TablesOfContents
returnValue = tablesOfContents1.Add(Range, UseHeadingStyles, UpperHeadingLevel, LowerHeadingLevel, UseFields, TableID, RightAlignPageNumbers, IncludePageNumbers, AddedStyles, UseHyperlinks, HidePageNumbersInWeb, UseOutlineLevels)
Syntax
Function Add( _
<InAttribute()> ByVal Range As Range, _
<InAttribute()> Optional ByRef UseHeadingStyles As Object, _
<InAttribute()> Optional ByRef UpperHeadingLevel As Object, _
<InAttribute()> Optional ByRef LowerHeadingLevel As Object, _
<InAttribute()> Optional ByRef UseFields As Object, _
<InAttribute()> Optional ByRef TableID As Object, _
<InAttribute()> Optional ByRef RightAlignPageNumbers As Object, _
<InAttribute()> Optional ByRef IncludePageNumbers As Object, _
<InAttribute()> Optional ByRef AddedStyles As Object, _
<InAttribute()> Optional ByRef UseHyperlinks As Object, _
<InAttribute()> Optional ByRef HidePageNumbersInWeb As Object, _
<InAttribute()> Optional ByRef UseOutlineLevels As Object _
) As TableOfContents
TableOfContents Add(
[In] Range Range,
[In, Optional] ref object UseHeadingStyles,
[In, Optional] ref object UpperHeadingLevel,
[In, Optional] ref object LowerHeadingLevel,
[In, Optional] ref object UseFields,
[In, Optional] ref object TableID,
[In, Optional] ref object RightAlignPageNumbers,
[In, Optional] ref object IncludePageNumbers,
[In, Optional] ref object AddedStyles,
[In, Optional] ref object UseHyperlinks,
[In, Optional] ref object HidePageNumbersInWeb,
[In, Optional] ref object UseOutlineLevels
);
public: TableOfContents^ Add(
Range^ Range,
&Object^ UseHeadingStyles,
&Object^ UpperHeadingLevel,
&Object^ LowerHeadingLevel,
&Object^ UseFields,
&Object^ TableID,
&Object^ RightAlignPageNumbers,
&Object^ IncludePageNumbers,
&Object^ AddedStyles,
&Object^ UseHyperlinks,
&Object^ HidePageNumbersInWeb,
&Object^ UseOutlineLevels
);
public TableOfContents Add(
/*in*/Range Range,
/*in*/System.Object UseHeadingStyles,
/*in*/System.Object UpperHeadingLevel,
/*in*/System.Object LowerHeadingLevel,
/*in*/System.Object UseFields,
/*in*/System.Object TableID,
/*in*/System.Object RightAlignPageNumbers,
/*in*/System.Object IncludePageNumbers,
/*in*/System.Object AddedStyles,
/*in*/System.Object UseHyperlinks,
/*in*/System.Object HidePageNumbersInWeb,
/*in*/System.Object UseOutlineLevels
);
function Add(
Range : Range,
UseHeadingStyles : Object,
UpperHeadingLevel : Object,
LowerHeadingLevel : Object,
UseFields : Object,
TableID : Object,
RightAlignPageNumbers : Object,
IncludePageNumbers : Object,
AddedStyles : Object,
UseHyperlinks : Object,
HidePageNumbersInWeb : Object,
UseOutlineLevels : Object
) : TableOfContents;
Parameters
- 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
Optional Object. True to use built-in heading styles to create the table of contents. The default value is True.
- UpperHeadingLevel
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
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
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
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
Optional Object. True if page numbers in the table of contents are aligned with the right margin. The default value is True.
- IncludePageNumbers
Optional Object. True to include page numbers in the table of contents. The default value is True.
- AddedStyles
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
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
Optional Object. True to use outline levels to create the table of contents. The default is False.
- UseOutlineLevels
Optional Object. True to use outline levels to create the table of contents. The default is False.
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Platforms
Development Platforms
Windows XP Home Edition, Windows XP Professional, Windows Server 2003, and Windows 2000
Target Platforms
See Also
Reference
TablesOfContents Interface
Microsoft.Office.Interop.Word Namespace