Compare of Variables and Document properties
Leave feedback
On this page
GroupDocs.Comparison allows you to compare various properties of a Word document such as Variable, Built, and Custom properties.
Use the following methods of the CompareOptions class to enable comparison functions for document properties:
setCompareVariableProperty() allows the comparison of variable properties
setCompareDocumentProperty() allows the comparison of built and custom properties
To activate the comparison of document properties, follow these steps:
Instantiate the Comparer object. Specify the source file path or stream.
Call the add() method. Specify the target file path or stream.
Instantiate the CompareOptions object. Call the setCompareVariableProperty() method to compare the variable properties and/or the setCompareDocumentProperty() for built and custom properties.
Call the compare() method. Specify the CompareOptions object from the previous step.
The following code snippet shows how to activate the comparison of the variable, Bbuilt and custom properties:
constcomparer=newgroupdocs.comparison.Comparer(sourcePath);comparer.add(targetPath);constoptions=newgroupdocs.comparison.CompareOptions();options.setCompareVariableProperty(true);// to activate the comparison of variable properties
options.setCompareDocumentProperty(true);// to activate the comparison of built and custom properties
constresultPath=comparer.compare(outputPath,options);
The result is as follows:
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.