Table of Contents

New

Insert a Table of Contents and hidden TC field markers with InsertTableOfContentsMarker so each section appears as a top-level TOC entry.

Xceed.Words.NET

The document starts with a Table of Contents. Each section is labeled with a hidden InsertTableOfContentsMarker entry New plus Heading styles for sub-entries. Those titles are written into the TOC. Word refreshes the page numbers when the file is opened.

Hidden TOC markers
New

Markers are not visible in the body. They are collected by the TOC \f switch (identifier p). Headings inside each section still appear as indented sub-entries.

Sections

Section 1

TOC / marker title
Heading 1
Body
Heading 2 (optional)

Section 2

TOC / marker title
Heading 1
Body
Heading 2 (optional)

Section 3

TOC / marker title
Heading 1
Body
Heading 2 (optional)
Words for .NET

Try Words for .NET free for 45 days with full document creation and editing features.

Workbooks for .NET

Try Workbooks for .NET free for 45 days and unlock advanced spreadsheet generation.

PDF Library for .NET

Try PDF Library for .NET free for 45 days and build, edit, and secure PDF files.