Set a Password for the Resultant Document

GroupDocs.Comparison for Python via .NET can apply a password to the comparison result. Combine CompareOptions.password_save_option = PasswordSaveOption.USER with SaveOptions.password = "<your password>".

Example: Password-protect the result document

from groupdocs.comparison import Comparer
from groupdocs.comparison.options import CompareOptions, SaveOptions, PasswordSaveOption

def set_password_for_resultant_document():
    with Comparer("./source.docx") as comparer:
        comparer.add("./target.docx")

        compare_options = CompareOptions()
        compare_options.password_save_option = PasswordSaveOption.USER

        save_options = SaveOptions()
        save_options.password = "3333"

        comparer.compare("./result.docx", save_options, compare_options)

if __name__ == "__main__":
    set_password_for_resultant_document()

source.docx is the source file used in this example. Click here to download it.

target.docx is the target file used in this example. Click here to download it.

Binary file (DOCX, 25 KB)

Download full output

Opening result.docx will require the password 3333.

Close
Loading

Analyzing your prompt, please hold on...

An error occurred while retrieving the results. Please refresh the page and try again.