# Set-OfficeWordTableOfContents

Sets properties on a table of contents in a Word document.

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 **725**

Forks **84**

Open issues **3**

Total downloads **5,231,343**

Release **OfficeIMO-v3.6.2**

Language: C# Updated: 2026-11-23

Cmdlet 

**Module**

`PSWriteOffice`

**Inputs**

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

**Outputs**

`OfficeIMO.Word.WordTableOfContent`

**Source**

[SetOfficeWordTableOfContentsCommand.cs:32](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Word/SetOfficeWordTableOfContentsCommand.cs#L32) 

Sets properties on a table of contents in a Word document.

## Syntax

```
Set-OfficeWordTableOfContents
[-PassThru]
[-TableOfContents <WordTableOfContent>]
[-Text <String>]
[-TextNoContent <String>]
[<CommonParameters>]
```

[#](#method-set-officewordtableofcontents-switchparameter-wordtableofcontent-string-string)

Parameter set: `TableOfContents`

```
Set-OfficeWordTableOfContents
[-Document <WordDocument>]
[-PassThru]
[-Text <String>]
[-TextNoContent <String>]
[<CommonParameters>]
```

[#](#method-set-officewordtableofcontents-worddocument-switchparameter-string-string)

Parameter set: `Document`

## Examples

### Customize table of contents text during composition.

```powershell
New-OfficeWord -Path .\Report.docx {
    Add-OfficeWordTableOfContents
    Set-OfficeWordTableOfContents -Text 'Contents' -TextNoContent 'No entries yet'
    Add-OfficeWordParagraph -Text 'Executive summary' -Style Heading1
    Update-OfficeWordTableOfContents
}
```

Updates TOC display text, adds heading content, and marks the TOC for refresh.

### Update an existing TOC object from a document.

```powershell
$doc = Get-OfficeWord -Path .\Report.docx
$doc |
    Get-OfficeWordTableOfContents |
    Set-OfficeWordTableOfContents -Text 'Report contents'
$doc | Save-OfficeWord -Path .\Report-Toc.docx
```

Pipes the OfficeIMO TOC object into the thin setter and saves the document.

## Parameters

**-PassThru SwitchParameter optional**

Emit the updated table of contents.

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

Table of contents to update.

**-Text String optional**

Heading text for the table of contents.

**-TextNoContent String optional**

Text shown when the table of contents has no entries.

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

Document to update when provided explicitly.

## 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:A7454ECD4573852FDFAD1702FE06EC117F52EF7982BA38B3D1FDC74A6855818C -->
