API Reference

Class

WordTableOfContent

Namespace OfficeIMO.Word
Assembly OfficeIMO.Word

Represents a table of contents within a Word document.

Inheritance

Usage

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

Constructors

WordTableOfContent 2 overloads
public WordTableOfContent(WordDocument wordDocument, TableOfContentStyle tableOfContentStyle, Int32 minLevel = 1, Int32 maxLevel = 3) #

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

Parameters

wordDocument OfficeIMO.Word.WordDocument requiredposition: 0
Parent document where the table of contents will be created.
tableOfContentStyle OfficeIMO.Word.TableOfContentStyle requiredposition: 1
Template style used to generate the table of contents.
minLevel System.Int32 = 1 optionalposition: 2
Minimum heading level to include (1..9).
maxLevel System.Int32 = 3 optionalposition: 3
Maximum heading level to include (1..9).
public WordTableOfContent(WordDocument wordDocument, SdtBlock sdtBlock) #

Initializes a new instance of the WordTableOfContent class using an existing structured document tag.

Parameters

wordDocument OfficeIMO.Word.WordDocument requiredposition: 0
Parent document that owns the table of contents.
sdtBlock DocumentFormat.OpenXml.Wordprocessing.SdtBlock requiredposition: 1
Structured document tag representing the table of contents.

Methods

MarkFieldsAsDirty() #

Marks all fields that participate in the table of contents as dirty so Word refreshes them on open.

Returns

true when an update should be queued. This includes corrupted tables of contents that no longer expose any fields so the caller can still request a refresh without throwing.

PrepareTemplate(OfficeIMO.Word.WordDocument document, OfficeIMO.Word.TableOfContentStyle style) #

Returns a predefined structured document tag matching the chosen style.

Parameters

document OfficeIMO.Word.WordDocument required
Document that will own the structured document tag.
style OfficeIMO.Word.TableOfContentStyle required
Template identifier to retrieve.
public WordCaptionListRefreshReport RefreshCaptionList(String sequenceIdentifier, String title = null) #
Returns: WordCaptionListRefreshReport

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

Parameters

sequenceIdentifier System.String requiredposition: 0
Caption sequence identifier, for example Figure or Table.
title System.String = null optionalposition: 1
Optional title shown above the generated list.

Returns

A report describing the generated caption-list entries.

public WordTableOfContentRefreshReport RefreshEntries() #
Returns: WordTableOfContentRefreshReport

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

Returns

A report describing the generated entries and skipped headings.

RefreshIndex 3 overloads
public WordIndexRefreshReport RefreshIndex(String title = null) #
Returns: WordIndexRefreshReport

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

Parameters

title System.String = null optionalposition: 0
Optional title shown above the generated index.

Returns

A report describing the generated index entries.

public WordIndexRefreshReport RefreshIndex(String title, String entryType) #
Returns: WordIndexRefreshReport

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

Parameters

title System.String requiredposition: 0
Optional title shown above the generated index.
entryType System.String requiredposition: 1
Optional Word index entry type from XE \f switches. Pass null to include all entry types.

Returns

A report describing the generated index entries.

public WordIndexRefreshReport RefreshIndex(String title, String entryType, String bookmarkName) #
Returns: WordIndexRefreshReport

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

Parameters

title System.String requiredposition: 0
Optional title shown above the generated index.
entryType System.String requiredposition: 1
Optional Word index entry type from XE \f switches. Pass null to include all entry types.
bookmarkName System.String requiredposition: 2
Optional Word bookmark name from an INDEX \b switch. Pass null to scan the whole body.

Returns

A report describing the generated index entries.

public WordCaptionListRefreshReport RefreshListOfFigures() #
Returns: WordCaptionListRefreshReport

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

Returns

A report describing the generated figure-list entries.

public WordCaptionListRefreshReport RefreshListOfTables() #
Returns: WordCaptionListRefreshReport

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

Returns

A report describing the generated table-list entries.

public WordTableOfContent Regenerate() #
Returns: WordTableOfContent

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

Returns

The newly created WordTableOfContent instance.

public Void Remove() #
Returns: Void

Deletes this table of contents from the parent document.

public Void SetLevels(Int32 minLevel, Int32 maxLevel) #
Returns: Void

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

Parameters

minLevel System.Int32 requiredposition: 0
Minimum heading level to include (1..9).
maxLevel System.Int32 requiredposition: 1
Maximum heading level to include (1..9).
public Void Update() #
Returns: Void

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

Properties

SdtBlock #

Exposes the underlying structured document tag for this table of contents.

public TableOfContentStyle Style { get; } #

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

public Int32 MinLevel { get; } #

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

public Int32 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 String TextNoContent { get; set; } #

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

Template1 #

Structured document tag implementing the default table-of-contents layout.

Template2 #

Alternative layout used for table-of-contents generation.