Evotec

Project

PSWriteOffice

PSWriteOffice is an open-source PowerShell and .NET project with packages, release history, and technical documentation.

Stars 144
Forks 12
Open issues 16
PowerShell Gallery downloads 150,904
Release v0.2.0
Language: C# Updated: 2026-04-06

API Reference

Cmdlet

Add-OfficeWordField

Namespace PSWriteOffice
Inputs
OfficeIMO.Word.WordParagraph
Outputs
System.Object

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 <Nullable`1>] [-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 Nullable`1 optionalposition: namedpipeline: False
Optional field format switch.
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: 71
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

Outputs

System.Object