Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Compare-OfficeWordDocument

Module PSWriteOffice
Inputs
None
Outputs
OfficeIMO.Word.WordComparisonResult

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

Syntax

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

Examples

Authored help example

Create a structured comparison and redline.

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

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

Parameters

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

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.