Evotec

Project

PSWriteOffice

PSWriteOffice is an open-source PowerShell and .NET project with packages, release history, and technical documentation.

Stars 144
Forks 12
Open issues 16
PowerShell Gallery downloads 150,904
Release v0.2.0
Language: C# Updated: 2026-04-06

API Reference

Cmdlet

New-OfficeWord

Namespace PSWriteOffice
Inputs
None
Outputs
System.Object

Creates a Word document using the DSL.

Remarks

Handles file creation, scriptblock execution, optional autosave, and emits the document path when -PassThru is used.

Examples

Authored help example

Create a document inline.

PS>


New-OfficeWord -Path .\Report.docx { WordSection { WordParagraph 'Hello DSL' } } -Open
        

Builds a document, adds one paragraph, saves it to disk, and opens it.

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

New-OfficeWord [-AutoSave] [-Content <ScriptBlock>] [-NoSave] [-Open] -OutputPath <String> [-PassThru] [<CommonParameters>]
#
Parameter set: All Parameter Sets

Parameters

AutoSave SwitchParameter optionalposition: namedpipeline: False
Enable OfficeIMO AutoSave mode.
Content ScriptBlock optionalposition: 1pipeline: False
DSL scriptblock describing document content.
NoSave SwitchParameter optionalposition: namedpipeline: False
Skip saving after executing the DSL.
Open SwitchParameter optionalposition: namedpipeline: False
Open the document after saving.
OutputPath String requiredposition: 0pipeline: Falsealiases: FilePath, Path
Destination path for the document.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit a FileInfo for chaining.

Outputs

System.Object