Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Update-OfficeWordField

Module
PSWriteOffice
Inputs
OfficeIMO.Word.WordDocument
Outputs
OfficeIMO.Word.WordDocument

Updates fields in a Word document.

Syntax

Update-OfficeWordField
[-Document <WordDocument>]
[-PassThru]
[<CommonParameters>]
#
Parameter set: Default

Description

Refreshes page number fields and queues table-of-contents updates.

Examples

Update fields before saving a generated report.

New-OfficeWord -Path .\Report.docx {
    Add-OfficeWordParagraph -Text 'Release report'
    Add-OfficeWordTableOfContents
    Update-OfficeWordField
}

Updates PAGE and NUMPAGES fields and marks TOC fields as dirty before saving.

Parameters

-Document WordDocument optionalpipeline: True (ByValue)
Document to update when provided explicitly.
-PassThru SwitchParameter optional
Emit the updated document.

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.