Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Add-OfficeWordField

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

Adds a field to the current paragraph.

Syntax

Add-OfficeWordField
[-Advanced]
[-CustomFormat <String>]
[-Format <WordFieldFormat>]
[-Paragraph <WordParagraph>]
[-Parameters <String[]>]
[-PassThru]
[-Type] <WordFieldType>
[<CommonParameters>]
#
Parameter set: Type
Add-OfficeWordField
[-CustomFormat <String>]
[-Format <WordFieldFormat>]
-MergeField <String>
[-Paragraph <WordParagraph>]
[-PassThru]
[<CommonParameters>]
#
Parameter set: MergeField
Add-OfficeWordField
[-CustomFormat <String>]
-DocumentProperty <String>
[-Format <WordFieldFormat>]
[-Paragraph <WordParagraph>]
[-PassThru]
[<CommonParameters>]
#
Parameter set: DocumentProperty
Add-OfficeWordField
-Bookmark <String>
[-CustomFormat <String>]
[-Format <WordFieldFormat>]
[-Paragraph <WordParagraph>]
[-PassThru]
[<CommonParameters>]
#
Parameter set: Bookmark

Description

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

Examples

Add a page number field.

Add-OfficeWordParagraph { Add-OfficeWordField -Type Page }

Inserts a PAGE field into the paragraph.

Parameters

-Advanced SwitchParameter optionalsets: Type
Use advanced field representation.
-CustomFormat String optional
Custom format string (date/time fields).
-Format WordFieldFormat optional
Optional field format switch.
Possible values: Lower, Upper, FirstCap, Caps, MergeFormat, UpperRoman, LowerRoman, Arabic, LowerLetter, UpperLetter, Ordinal, OrdText, CardText, DollarText, Hex, CharFormat
-Paragraph WordParagraph optionalpipeline: True (ByValue)
Explicit paragraph to receive the field.
-Parameters String[] optionalsets: Type
Additional field parameters.
-PassThru SwitchParameter optional
Emit the paragraph after adding the field.
-Type WordFieldType requiredposition: 0sets: Type
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
-MergeField String requiredsets: MergeField
Mail-merge field name.
-DocumentProperty String requiredsets: DocumentProperty
Built-in or custom document property to display.
-Bookmark String requiredsets: Bookmark
Bookmark to reference.

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.