Project

PSWriteOffice

PowerShell document automation across Word, Excel, PowerPoint, PDF, Reader, Confluence, Visio, and open text formats.

Stars 159
Forks 14
PowerShell Gallery downloads 158,661
Release v3.0.5
Language: C# Updated: 2026-09-03

API Reference

Cmdlet

Compare-OfficeWordDocument

Namespace PSWriteOffice
Inputs
None
Outputs
OfficeIMO.Word.WordComparisonResult

Compares two Word documents and optionally writes a tracked-change redline.

Remarks

Compares two Word documents and optionally writes a tracked-change redline.

Examples

Authored help example

Create a structured comparison and redline.

PS>


$result = Compare-OfficeWordDocument -ReferencePath .\Before.docx -DifferencePath .\After.docx -RedlinePath .\Redline.docx
        

Returns deterministic findings and saves a Word document containing revision marks.

Ignore whitespace and volatile metadata.

PS>


$options = New-OfficeWordComparisonOptions -IgnoreWhitespace -CompareVolatileMetadata:$false
            Compare-OfficeWordDocument -ReferencePath .\Before.docx -DifferencePath .\After.docx -Options $options
        

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

Compare-OfficeWordDocument -DifferencePath <String> [-Options <WordComparisonOptions>] [-RedlinePath <String>] -ReferencePath <String> [<CommonParameters>]
#
Parameter set: All Parameter Sets

Parameters

DifferencePath String requiredposition: 1pipeline: False
Path to the modified Word document.
Options WordComparisonOptions optionalposition: namedpipeline: False
Optional structural comparison switches.
RedlinePath String optionalposition: namedpipeline: False
Optional path for a tracked-change redline document.
ReferencePath String requiredposition: 0pipeline: False
Path to the original Word document.

Outputs

OfficeIMO.Word.WordComparisonResult