API Reference

Cmdlet

Get-OfficeWord

Opens an existing Word document.

Remarks

Returns an OfficeIMO WordDocument for inspection, advanced operations, or optional DSL edits.

Examples

Authored help example

Example 1: Load a document in read-only mode.

PS>


$doc = Get-OfficeWord -Path .\Report.docx -ReadOnly
        

Loads Report.docx and exposes the document object for querying.

Example 2: Run the Word DSL against an existing document.

PS>


$doc = Get-OfficeWord -Path .\Report.docx { WordParagraph -Text 'Appended by DSL' }; $doc | Save-OfficeWord
        

Loads the document, appends content through the DSL, and returns the open document for saving or further edits.

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

Get-OfficeWord [-AutoSave] [-Content <ScriptBlock>] -InputPath <String> [-Password <String>] [-ReadOnly] [<CommonParameters>]
#
Parameter set: All Parameter Sets

Parameters

AutoSave SwitchParameter optionalposition: namedpipeline: False
Enable AutoSave when editing.
Content ScriptBlock optionalposition: 1pipeline: False
Optional DSL scriptblock to execute against the loaded document.
InputPath String requiredposition: 0pipeline: Falsealiases: FilePath, Path
Path to the .docx. Accepts PS paths.
Password String optionalposition: namedpipeline: False
Password used to open an encrypted document package.
ReadOnly SwitchParameter optionalposition: namedpipeline: False
Open in read-only mode.