# Update-OfficeWordTableOfContents

Updates the table of contents in 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 

**Module**

`PSWriteOffice`

**Inputs**

`OfficeIMO.Word.WordDocument` `OfficeIMO.Word.WordTableOfContent`

**Outputs**

`OfficeIMO.Word.WordTableOfContent`

**Source**

[UpdateOfficeWordTableOfContentsCommand.cs:30](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Word/UpdateOfficeWordTableOfContentsCommand.cs#L30) 

Updates the table of contents in a Word document.

## Syntax

```
Update-OfficeWordTableOfContents
[-Document <WordDocument>]
[-PassThru]
[-Regenerate]
[<CommonParameters>]
```

[#](#method-update-officewordtableofcontents-worddocument-switchparameter-switchparameter)

Parameter set: `Document`

```
Update-OfficeWordTableOfContents
[-PassThru]
[-Regenerate]
[-TableOfContents <WordTableOfContent>]
[<CommonParameters>]
```

[#](#method-update-officewordtableofcontents-switchparameter-switchparameter-wordtableofcontent)

Parameter set: `TableOfContents`

## Examples

### Mark table of contents for refresh on open.

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

Marks TOC fields as dirty and updates the document settings so Word refreshes the TOC when opened.

### Regenerate a TOC in an existing document object.

```powershell
$doc = Get-OfficeWord -Path .\Report.docx
$doc | Update-OfficeWordTableOfContents -Regenerate
$doc | Save-OfficeWord -Path .\Report-RegeneratedToc.docx
```

Uses OfficeIMO's regenerate path, then saves the updated document.

## Parameters

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

Document to update when provided explicitly.

**-PassThru SwitchParameter optional**

Emit the updated table of contents.

**-Regenerate SwitchParameter optional**

Rebuild the table of contents before updating.

**-TableOfContents WordTableOfContent optionalpipeline: True (ByValue)sets: TableOfContents**

Table of contents to update.

## 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:0A7249A2FDDE413ED98636BEED81488ED250CA8CD41FAD94A5280D798D223E35 -->
