API Reference

Cmdlet

Join-OfficeWordDocument

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

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

Remarks

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

Examples

Authored help example

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

PS>


$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.

PS>


$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.

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

Join-OfficeWordDocument -AppendPath <String[]> -InputPath <String> [-OutputPath <String>] [-PassThru] [-Show] [<CommonParameters>]
#
Parameter set: Path

Parameters

AppendPath String[] requiredposition: 1pipeline: Falsealiases: SourcePath
Documents to append to the base document.
InputPath String requiredposition: 0pipeline: Falsealiases: BasePath, Path
Base document path.
OutputPath String optionalposition: namedpipeline: False
Optional output path. When omitted for path input, the base document is updated in place.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the merged Word document instead of disposing it.
Show SwitchParameter optionalposition: namedpipeline: False
Open the saved output with the shell.

Outputs

OfficeIMO.Word.WordDocument

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

Parameters

AppendPath String[] requiredposition: 1pipeline: Falsealiases: SourcePath
Documents to append to the base document.
Document WordDocument requiredposition: namedpipeline: True (ByValue)
Base document object.
OutputPath String optionalposition: namedpipeline: False
Optional output path. When omitted for path input, the base document is updated in place.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the merged Word document instead of disposing it.
Show SwitchParameter optionalposition: namedpipeline: False
Open the saved output with the shell.

Outputs

OfficeIMO.Word.WordDocument