Project

PSWriteOffice

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

Stars159
Forks14
Open issues0
PowerShell Gallery downloads158661
Releasev3.0.5
Language: C# Updated: 2026-09-03T07:09:53.0000000+00:00

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

The DSL cookbook explains how the scoped commands fit together and how to reuse the same input objects across formats.

Task guides

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 with Resolve-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.