# Add-OfficeWordTableOfContents

Adds a table of contents to a Word document. Review available syntax, parameters, pipeline guidance, and reference details in PSWriteOffice API Reference.

Project

PSWriteOffice

PowerShell document automation across OfficeIMO's document, spreadsheet, presentation, PDF, Project, Access, EPUB, invoicing, and conversion engines.

[View on GitHub](https://github.com/EvotecIT/OfficeIMO/tree/master/PowerShell/PSWriteOffice) [Visit Website](#) [Releases](https://github.com/EvotecIT/PSWriteOffice/releases/tag/v3.0.5) [Changelog](#) [Get package](https://www.powershellgallery.com/packages/PSWriteOffice/0.2.0)

Stars **727**

Forks **84**

Open issues **7**

Total downloads **5,275,783**

Release **OfficeIMO-v3.6.2**

Language: C# Updated: 2026-11-24

Cmdlet 

Aliases: WordTableOfContents

**Module**

`PSWriteOffice`

**Aliases**

`WordTableOfContents`

**Inputs**

`OfficeIMO.Word.WordDocument`

**Outputs**

`OfficeIMO.Word.WordTableOfContent`

**Source**

[AddOfficeWordTableOfContentsCommand.cs:25](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Word/AddOfficeWordTableOfContentsCommand.cs#L25) 

Adds a table of contents to a Word document.

## Syntax

```
Add-OfficeWordTableOfContents
[-Document <WordDocument>]
[-PassThru]
[-Style <Template1|Template2>]
[<CommonParameters>]
```

[#](#method-add-officewordtableofcontents-worddocument-switchparameter-wordtableofcontentsstyle)

Parameter set: `All Parameter Sets`

## Examples

### Add a table of contents before report sections.

```powershell
New-OfficeWord -Path .\ExecutiveReport.docx {
    Add-OfficeWordTableOfContents -Style Template1
    Add-OfficeWordParagraph -Text 'Executive summary' -Style Heading1
    Add-OfficeWordParagraph -Text 'Summary text'
    Add-OfficeWordParagraph -Text 'Appendix' -Style Heading1
    Add-OfficeWordParagraph -Text 'Supporting details'
    Update-OfficeWordTableOfContents
}
```

Creates a navigable report outline and marks the TOC for refresh when the document opens.

## Parameters

**-Document WordDocument optionalpipeline: True (ByValue)**

Document to modify when provided explicitly.

**-PassThru SwitchParameter optional**

Emit the created table of contents.

**-Style WordTableOfContentsStyle optional**

Table of contents template style.

Possible values: `Template1`, `Template2`

## Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see [about_CommonParameters](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

Evotec API Reference Copyright 2026 Evotec Services

<!-- PowerForge markdown artifact sha256:700E8F1FA91454C2975A53B26C0BC2468AA38FDB437047EF1EAFF60743952C1D -->
