API Reference

Cmdlet

Get-OfficeWordTableOfContents

Namespace PSWriteOffice
Inputs
OfficeIMO.Word.WordDocument
Outputs
OfficeIMO.Word.WordTableOfContent

Gets the table of contents from a Word document.

Remarks

Gets the table of contents from a Word document.

Examples

Authored help example

Read a table of contents before updating it.

PS>


$doc = Get-OfficeWord -Path .\Report.docx
            $toc = $doc | Get-OfficeWordTableOfContents
            if ($toc) {
                $toc | Set-OfficeWordTableOfContents -Text 'Contents' -TextNoContent 'No entries' -PassThru
                $doc | Save-OfficeWord -Path .\Report-Toc.docx
            }
        

Gets the TOC from an open document, updates it, and saves a variant.

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.

Syntax

Get-OfficeWordTableOfContents -InputPath <String> [<CommonParameters>]
#
Parameter set: Path

Parameters

InputPath String requiredposition: 0pipeline: Falsealiases: FilePath, Path
Path to the .docx file.

Outputs

OfficeIMO.Word.WordTableOfContent

Get-OfficeWordTableOfContents -Document <WordDocument> [<CommonParameters>]
#
Parameter set: Document

Parameters

Document WordDocument requiredposition: namedpipeline: True (ByValue)
Word document to read.

Outputs

OfficeIMO.Word.WordTableOfContent