GroupDocs.Comparison allows you to compare documents that are protected with a password.
The following code snippet shows how to load and compare password-protected Excel documents.
'use strict';// Import the GroupDocs.Comparison for Node.js via Java SDK
constgroupdocs=require('@groupdocs/groupdocs.comparison');// Define file paths for the source, target, and result Excel documents
constsourceExcelDocument='sample-files/source.xlsx';consttargetExcelDocument='sample-files/target.xlsx';constresultExcelDocument='result.xlsx';// Initialize the comparer with the source document and its password
constcomparer=newgroupdocs.Comparer(sourceExcelDocument,newgroupdocs.LoadOptions('password')// password required to open the source file
);// Add the target document to the comparison session with its own password
comparer.add(targetExcelDocument,newgroupdocs.LoadOptions('password')// password required to open the target file
);// Execute the comparison and save the result to the specified output file
comparer.compare(resultExcelDocument);// Terminate the process with a success exit code
process.exit(0);
This example demonstrates how to compare password-protected documents. It creates LoadOptions objects with passwords for both the source and target documents. The Comparer is initialized with the source document path and a LoadOptions object containing the source document’s password. Similarly, when adding the target document, another LoadOptions object with the target document’s password is provided. The comparison then proceeds normally, with both documents being decrypted using their respective passwords.
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.
On this page
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.