Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Description

Excerpt

This class is used to get and set document protection settings for a document.

Signature
C#
C#
<p> public sealed class DocumentProtection</p>
Signature
vb.net
vb.net
<p>Public NotInheritable Class DocumentProtection</p>
Remarks

You cannot create a DocumentProtection object using the new keyword. You must get an existing DocumentProtection object from a Document.

MS Word equivalent: Tools menu > Protect Document...

The following sample gets the DocumentProtection object of a document so you can start working with these properties.

Example
Code Block
csharp
csharp
titleC#

          WordApplication app = new WordApplication();
          Document doc = app.Create();
          DocumentProtection docProtect = doc.DocumentProtection;
        
Code Block
vb.net
vb.net
titlevb.net

          Dim app As New WordApplication()
          Dim doc As Document = app.Create()
          Dim docProtect As DocumentProtection = doc.DocumentProtection
        
Properties

Name

Description

AnnotationsLocked

Excerpt Include
DocumentProtection.AnnotationsLocked
DocumentProtection.AnnotationsLocked
nopaneltrue

AutoFormatOverride

Excerpt Include
DocumentProtection.AutoFormatOverride
DocumentProtection.AutoFormatOverride
nopaneltrue

DocumentProtected

Excerpt Include
DocumentProtection.DocumentProtected
DocumentProtection.DocumentProtected
nopaneltrue

EnforceDocumentProtection

Excerpt Include
DocumentProtection.EnforceDocumentProtection
DocumentProtection.EnforceDocumentProtection
nopaneltrue

SelectOnlyFormFields

Excerpt Include
DocumentProtection.SelectOnlyFormFields
DocumentProtection.SelectOnlyFormFields
nopaneltrue

StylesLocked

Excerpt Include
DocumentProtection.StylesLocked
DocumentProtection.StylesLocked
nopaneltrue
Classes

Name

Description

ProtectionLevel

Excerpt Include
DocumentProtection.ProtectionLevel
DocumentProtection.ProtectionLevel
nopaneltrue