Documentation
Automate Word Documents
Create, inspect, update, review, merge, protect, and convert DOCX workflows from PowerShell.
The Word family covers complete report creation and targeted updates to existing DOCX files. Its 91 exported commands include sections, paragraphs, text runs, lists, tables, images, charts, fields, links, headers and footers, notes, content controls, review, protection, merging, mail merge, and conversion.
Build a report
Start with New-OfficeWord, add one or more sections, and compose content inside the active document context. Use canonical Add-OfficeWord* commands in shared or long-lived scripts; the shorter aliases are convenient for interactive DSL use.
$rows = @(
[pscustomobject]@{ Region = 'EMEA'; Revenue = 98000; Growth = '22%' }
[pscustomobject]@{ Region = 'APAC'; Revenue = 143000; Growth = '18%' }
)
New-OfficeWord -Path '.\Output\Revenue.docx' {
Add-OfficeWordSection {
Add-OfficeWordParagraph -Text 'Revenue report' -Style Heading1
Add-OfficeWordParagraph -Text 'Generated by a scheduled PowerShell job.'
Add-OfficeWordTable -InputObject $rows -Style 'GridTable1LightAccent2'
}
}
Inspect and update
Use Get-OfficeWord to load a file and the targeted Get-OfficeWord* and Find-OfficeWord* commands to locate content. Word inspection includes paragraphs, text, tables and cells, sections, images, shapes, lists, fields, bookmarks, notes, links, document properties, statistics, content controls, reviews, and tables of contents.
Update commands are intentionally specific: change text, styles, images, shapes, page setup, document properties, fields, or table-of-contents state without rebuilding the whole document.
Workflow capabilities
- Templates and data: mail merge, table conditions, calculated columns, document properties, fields, and reusable content blocks.
- Review: comments and revision inspection through
Get-OfficeWordReview, plus bounded resolution withResolve-OfficeWordRevision. - Forms: check boxes, combo boxes, date pickers, drop-down lists, picture controls, repeating sections, and general content controls.
- Delivery: merge documents, protect output, update fields and tables of contents, and convert to HTML or Markdown.
For exact syntax, search the PowerShell command reference for OfficeWord. See the Word examples for complete copyable scripts.