Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active January 5, 2021 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspose-com-gists/8233bdf649063a776aa32877e4061d14 to your computer and use it in GitHub Desktop.
Save aspose-com-gists/8233bdf649063a776aa32877e4061d14 to your computer and use it in GitHub Desktop.
Protect Unprotect Word Documents C++
// Load Word document
System::SharedPtr<Document> doc = System::MakeObject<Document>(inputFileName);
// Protect the document
doc->Protect(ProtectionType::AllowOnlyFormFields, u"password");
// Save the document
doc->Save(u"protected.doc");
// Load Word document
System::SharedPtr<Document> doc = System::MakeObject<Document>(inputFileName);
// Unprotect the document
doc->Unprotect();
// Save the document
doc->Save(u"unprotected.doc");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment