DocumentProtect Method (ProtectionType, String)
Protects the document from changes and optionally sets a protection password.

Namespace: Aspose.Words
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.12
Syntax
public void Protect(
	ProtectionType type,
	string password
)

Parameters

type
Type: Aspose.WordsProtectionType
Specifies the protection type for the document.
password
Type: SystemString
The password to protect the document with. Specify null or empty string if you want to protect the document without a password.
Remarks

When a document is protected, the user can make only limited changes, such as adding annotations, making revisions, or completing a form.

Note that document protection is different from write protection. Write protection is specified using the WriteProtection.

Examples
Shows how to protect a document.
Document doc = new Document();
doc.Protect(ProtectionType.AllowOnlyFormFields, "password");
See Also