Documentation
Automate Word Documents
Create, inspect, update, review, merge, protect, and convert DOCX workflows from PowerShell. Includes examples and cmdlet links.
The Word family covers complete report creation and targeted updates to existing DOCX files. Its 93 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.
Copy complete DSL recipes
- Project status report: header and footer, executive summary, conditional milestone table, progress chart, check box, and date picker.
- Change approval checklist: table of contents, risk selector, required-evidence table, approval controls, and watermark.
- Executive service report: the larger composition example with metadata, rich text, bookmarks, notes, tables, charts, and content controls.
Other Word workflows
- Object composition: hold a live document, add a paragraph and mixed-format runs, add a table, then save once.
- HTML to Word: turn an HTML fragment into an editable DOCX file.
- Compare documents: produce structured evidence about changes between two versions.
- Inspect, update, merge, and mail merge: work with documents supplied by another system.
The DSL cookbook explains how the scoped commands fit together and how to reuse the same input objects across formats.
Task guides
- Read and inspect existing documents
- Update existing documents
- Merge documents and generate letters
- Review, protect, and deliver
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.