TableOfContent module

class TableOfContent.TableOfContent

Bases: ParagraphBase, IDocumentObject

Represents a table of contents in a document.

property DocumentObjectType: DocumentObjectType

Gets the type of the document object.

Returns:

The type of the document object.

Return type:

DocumentObjectType

GetTOCLevelStyle(levelNumber: int) str

Gets the style name for TOC level.

Parameters:

levelNumber (int) – The level number.

Returns:

The level style.

Return type:

str

property IncludePageNumbers: bool

Gets or sets a value indicating whether to include page numbers in the table of contents.

property LowerHeadingLevel: int

Gets or sets the starting heading level of the table of contents. Default value is 1.

property RightAlignPageNumbers: bool

Gets or sets a value indicating whether to show page numbers from the right side in the table of contents.

SetTOCLevelStyle(levelNumber: int, styleName: str)

Sets the style for TOC level.

Parameters:
  • levelNumber (int) – The level number.

  • styleName (str) – Name of the style.

property TableID: str

Gets or sets the table ID for the table of contents.

property UpperHeadingLevel: int

Gets or sets the ending heading level of the table of contents. Default value is 3.

property UseAbsolutePos: bool

Gets or sets a value indicating whether to use absolute position for the table of contents.

property UseHeadingStyles: bool

Gets or sets a value indicating whether to use default heading styles for the table of contents.

Gets or sets a value indicating whether to use hyperlinks.Default value is true.

Returns:

if it uses hyperlinks, set to true.

Return type:

bool

property UseOutlineLevels: bool

Gets or sets a value indicating whether use outline levels.Default value is false.

Returns:

if it uses outline levels, set to true.

Return type:

bool

property UseTableEntryFields: bool

Gets or sets a value indicating whether to use table entry fields for the table of contents.