# New-OfficeWord

Creates a Word document using the DSL. Review available syntax, parameters, pipeline guidance, and reference details in PSWriteOffice API Reference.

Project

PSWriteOffice

PowerShell document automation across OfficeIMO's document, spreadsheet, presentation, PDF, Project, Access, EPUB, invoicing, and conversion engines.

[View on GitHub](https://github.com/EvotecIT/OfficeIMO/tree/master/PowerShell/PSWriteOffice) [Visit Website](#) [Releases](https://github.com/EvotecIT/PSWriteOffice/releases/tag/v3.0.5) [Changelog](#) [Get package](https://www.powershellgallery.com/packages/PSWriteOffice/0.2.0)

Stars **725**

Forks **84**

Open issues **3**

Total downloads **5,231,343**

Release **OfficeIMO-v3.6.2**

Language: C# Updated: 2026-11-23

Cmdlet 

Aliases: OfficeWord, WordNew

**Module**

`PSWriteOffice`

**Aliases**

`OfficeWord` `WordNew`

**Inputs**

`None`

**Source**

[NewOfficeWordCommand.cs:34](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Word/NewOfficeWordCommand.cs#L34) 

Creates a Word document using the DSL.

## Syntax

```
New-OfficeWord
[[-Content] <ScriptBlock>]
[-NoSave]
[-Open]
[-PassThru]
[-Password <String>]
[-Path] <String>
[-TemplatePath <String>]
[<CommonParameters>]
```

[#](#method-new-officeword-scriptblock-switchparameter-switchparameter-switchparameter-string-string-string)

Parameter set: `All Parameter Sets`

## Description

Handles file creation or template cloning, scriptblock execution, explicit save or live-document composition, and emits the document path when -PassThru is used.

## Guides & Samples

Authored walkthroughs and practical samples linked to this command.

- [Create a Word report](/projects/pswriteoffice/examples/create-word-report/) Example
  
  A curated example for generating a Word document from PowerShell.

## Examples

### Create a document inline.

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

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

### Create a document from a template.

```powershell
New-OfficeWord -TemplatePath .\Template.docx -Path .\Report.docx { WordParagraph -Text 'Generated content' -StyleId 'ReportBody' }
```

Copies the template to the output path, runs the DSL against the copied document, and saves it.

### Keep a document for incremental composition.

```powershell
$document = New-OfficeWord -Path .\Report.docx -NoSave
$document | Add-OfficeWordParagraph -Text 'Status report' -Style Heading1
$document | Save-OfficeWord
$document | Close-OfficeWord
```

Associates the output path with a live document, adds content through the pipeline, then saves and closes it once.

## Parameters

**-Content ScriptBlock optionalposition: 1**

DSL scriptblock describing document content.

**-NoSave SwitchParameter optional**

Skip saving after executing the DSL.

**-Open SwitchParameter optional**

Open the document after saving.

**-PassThru SwitchParameter optional**

Emit a FileInfo for chaining.

**-Password String optional**

Password used to save the document as an encrypted package.

**-Path String requiredposition: 0aliases: FilePath, OutputPath**

Destination path for the document.

**-TemplatePath String optional**

Existing .docx file to clone before running the DSL.

## 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](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

Evotec API Reference Copyright 2026 Evotec Services

<!-- PowerForge markdown artifact sha256:220B2F66F1CDAFAA30296E62FDCF9F926FE6AB69189E132DFEDE01308313AB67 -->
