Project

PSWriteOffice

PowerShell document automation across Word, Excel, PowerPoint, PDF, Reader, Confluence, Visio, and open text formats.

Stars 159
Forks 14
PowerShell Gallery downloads 158,661
Release v3.0.5
Language: C# Updated: 2026-09-03

API Reference

Cmdlet

Add-OfficeWordField

Aliases: WordField
Namespace PSWriteOffice
Aliases
WordField
Inputs
OfficeIMO.Word.WordParagraph

Adds a field to the current paragraph.

Remarks

Supports standard Word field codes such as Page, Date, or NumPages.

Examples

Authored help example

Add a page number field.

PS>


Add-OfficeWordParagraph { Add-OfficeWordField -Type Page }
        

Inserts a PAGE field into the paragraph.

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

Add-OfficeWordField [-Advanced] [-CustomFormat <String>] [-Format <Lower>] [-Paragraph <WordParagraph>] [-Parameters <String[]>] [-PassThru] -Type <AddressBlock> [<CommonParameters>]
#
Parameter set: All Parameter Sets

Parameters

Advanced SwitchParameter optionalposition: namedpipeline: False
Use advanced field representation.
CustomFormat String optionalposition: namedpipeline: False
Custom format string (date/time fields).
Format WordFieldFormat optionalposition: namedpipeline: Falsevalues: 14
Optional field format switch.
Possible values: Lower, Upper, FirstCap, Caps, Mergeformat, Roman, Arabic, Alphabetical, Ordinal, OrdText, CardText, DollarText, Hex, CharFormat
Paragraph WordParagraph optionalposition: namedpipeline: True (ByValue)
Explicit paragraph to receive the field.
Parameters String[] optionalposition: namedpipeline: False
Additional field parameters.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the paragraph after adding the field.
Type WordFieldType requiredposition: 0pipeline: Falsevalues: 73
Field type to insert.
Possible values: AddressBlock, Advance, Ask, Author, AutoNum, AutoNumLgl, AutoNumOut, AutoText, AutoTextList, Bibliography, Citation, Comments, Compare, CreateDate, Database, Date, DocProperty, DocVariable, Embed, FileName, FileSize, GoToButton, GreetingLine, HyperlinkIf, IncludePicture, IncludeText, Index, Info, Keywords, LastSavedBy, Link, ListNum, MacroButton, MergeField, MergeRec, MergeSeq, Next, NextIf, NoteRef, NumChars, NumPages, NumWords, Page, PageRef, Print, PrintDate, Private, Quote, RD, Ref, RevNum, SaveDate, Section, SectionPages, Seq, Set, SkipIf, StyleRef, Subject, Symbol, TA, TC, Template, Time, Title, TOA, TOC, UserAddress, UserInitials, UserName, XE, Formula, EQ