Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

WordTableOfContent

OfficeIMO.Word

Namespace
OfficeIMO.Word
Assembly
OfficeIMO.Word
Source revision
0eef6a5756b9 with working tree changes

Represents a table of contents within a Word document.

Inheritance

Usage

Explore 4 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Constructors

public WordTableOfContent(WordDocument wordDocument, WordTableOfContentsStyle tableOfContentStyle, int minLevel = 1, int maxLevel = 3) #

Initializes a new instance of the WordTableOfContent class and appends it to the document body.

Parameters

wordDocument OfficeIMO.Word.WordDocument required
Parent document where the table of contents will be created.
tableOfContentStyle OfficeIMO.Word.WordTableOfContentsStyle required
Template style used to generate the table of contents.
minLevel int = 1 optional
Minimum heading level to include (1..9).
maxLevel int = 3 optional
Maximum heading level to include (1..9).

Methods

public WordCaptionListRefreshReport RefreshCaptionList(string sequenceIdentifier, string? title = null) #

Regenerates visible list entries from generated caption paragraphs that contain a matching SEQ field.

Parameters

sequenceIdentifier string required
Caption sequence identifier, for example Figure or Table.
title string? = null optional
Optional title shown above the generated list.

Returns

WordCaptionListRefreshReport A report describing the generated caption-list entries.
public WordTableOfContentRefreshReport RefreshEntries() #

Regenerates visible table-of-contents entries from body heading paragraphs.

Returns

WordTableOfContentRefreshReport A report describing the generated entries and skipped headings.
RefreshIndex 3 overloads
public WordIndexRefreshReport RefreshIndex(string? title = null) #

Regenerates visible index entries from XE fields that OfficeIMO can evaluate deterministically.

Parameters

title string? = null optional
Optional title shown above the generated index.

Returns

WordIndexRefreshReport A report describing the generated index entries.
public WordIndexRefreshReport RefreshIndex(string? title, string? entryType) #

Regenerates visible index entries from XE fields matching the requested entry type.

Parameters

title string? required
Optional title shown above the generated index.
entryType string? required
Optional Word index entry type from XE \f switches. Pass null to include all entry types.

Returns

WordIndexRefreshReport A report describing the generated index entries.
public WordIndexRefreshReport RefreshIndex(string? title, string? entryType, string? bookmarkName) #

Regenerates visible index entries from body XE fields matching the requested entry type and bookmark scope.

Parameters

title string? required
Optional title shown above the generated index.
entryType string? required
Optional Word index entry type from XE \f switches. Pass null to include all entry types.
bookmarkName string? required
Optional Word bookmark name from an INDEX \b switch. Pass null to scan the whole body.

Returns

WordIndexRefreshReport A report describing the generated index entries.
public WordCaptionListRefreshReport RefreshListOfFigures() #

Regenerates a generated list of figures from caption paragraphs that contain SEQ Figure fields.

Returns

WordCaptionListRefreshReport A report describing the generated figure-list entries.
public WordCaptionListRefreshReport RefreshListOfTables() #

Regenerates a generated list of tables from caption paragraphs that contain SEQ Table fields.

Returns

WordCaptionListRefreshReport A report describing the generated table-list entries.
public WordTableOfContent Regenerate() #

Removes this table of contents and creates a new one in the same location.

Returns

WordTableOfContent The newly created WordTableOfContent instance.
public void Remove() #

Deletes this table of contents from the parent document.

public void SetLevels(int minLevel, int maxLevel) #

Updates the heading levels included by the TOC field switch (for example: \o "1-5").

Parameters

minLevel int required
Minimum heading level to include (1..9).
maxLevel int required
Maximum heading level to include (1..9).
public void Update() #

Flags the document to update this table of contents when the file is opened.

Properties

public WordTableOfContentsStyle Style { get; } #

Gets the template style used to create this table of contents.

public int MinLevel { get; } #

Gets the minimum heading level included by the TOC field switch.

public int MaxLevel { get; } #

Gets the maximum heading level included by the TOC field switch.

public string Text { get; set; } #

Gets or sets the heading text displayed for the table of contents.

public WordParagraph? TitleParagraph { get; } #

Gets the existing title paragraph, or null when this table of contents has no title.

public string TextNoContent { get; set; } #

Gets or sets the text shown when the document has no entries for the table of contents.