API Reference

Cmdlet

Update-OfficeWordFields

Namespace PSWriteOffice
Inputs
OfficeIMO.Word.WordDocument

Updates fields in a Word document.

Remarks

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

Examples

Authored help example

Example 1: Update fields before saving a generated report.

PS>


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

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

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

Update-OfficeWordFields [-Document <WordDocument>] [-PassThru] [<CommonParameters>]
#
Parameter set: All Parameter Sets

Parameters

Document WordDocument optionalposition: namedpipeline: True (ByValue)
Document to update when provided explicitly.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the updated document.