Project

PSWriteOffice

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

Stars 654
Forks 82
Open issues 1
Total downloads 4,320,051
Release OfficeIMO-v3.5.3
Language: C# Updated: 2026-11-03
Cmdlet

Join-OfficeWordDocument

Aliases: Merge-OfficeWordDocument, WordDocumentJoin
Module
PSWriteOffice
Aliases
Merge-OfficeWordDocument WordDocumentJoin
Inputs
OfficeIMO.Word.WordDocument
Outputs
OfficeIMO.Word.WordDocument

Appends one or more Word documents into a base Word document.

Syntax

Join-OfficeWordDocument
[-AppendPath] <String[]>
[-Open]
[-OutputPath <String>]
[-PassThru]
[-Path] <String>
[<CommonParameters>]
#
Parameter set: Path
Join-OfficeWordDocument
[-AppendPath] <String[]>
-Document <WordDocument>
[-Open]
[-OutputPath <String>]
[-PassThru]
[<CommonParameters>]
#
Parameter set: Document

Description

Uses OfficeIMO.Word document append support and preserves the wrapper as an operator-friendly merge command.

Examples

Merge a cover, body, and appendix into a release packet.

$proof = @(
    Join-OfficeWordDocument -Path .\Cover.docx -AppendPath .\Body.docx, .\Appendix.docx -OutputPath .\ReleasePacket.docx
    Get-OfficeWordStatistics -Path .\ReleasePacket.docx |
        Select-Object -Property Paragraphs, Tables, Images
)
$proof

Appends the source documents with OfficeIMO.Word and then reads back basic structure from the merged output.

Append into an already-open document object.

$doc = Get-OfficeWord -Path .\Base.docx
$doc | Join-OfficeWordDocument -AppendPath .\Section1.docx, .\Section2.docx -PassThru |
    Save-OfficeWord -Path .\Combined.docx

Keeps the wrapper thin by piping the OfficeIMO document object through append and save commands.

Parameters

-AppendPath String[] requiredposition: 1aliases: SourcePath
Documents to append to the base document.
-Open SwitchParameter optionalaliases: Show
Open the saved output with the shell.
-OutputPath String optional
Optional output path. When omitted for path input, the base document is updated in place.
-PassThru SwitchParameter optional
Emit the merged Word document instead of disposing it.
-Path String requiredposition: 0aliases: BasePath, InputPathsets: Path
Base document path.
-Document WordDocument requiredpipeline: True (ByValue)sets: Document
Base document object.

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.