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
{signature}{signature:DocumentProtection</p>
} Public
Signature
vb.net
vb.net

<p>Public NotInheritable Class DocumentProtection
{signature}
{remarks}You cannot create a [DocumentProtection|DocumentProtection] object using the {{new}} keyword. You must get an existing {{DocumentProtection}} object from a [Document|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.

{remarks}
{example}{code:csharp|title=C#}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} {code:
Code Block
vb.net
|title=
vb.net
titlevb.net
}


          Dim app As New WordApplication()
          Dim doc As Document = app.Create()
          Dim docProtect As DocumentProtection = doc.DocumentProtection
        
{code} {example} {properties} ||Name||Description|| |[AnnotationsLocked|DocumentProtection.AnnotationsLocked]|{excerpt-include:DocumentProtection.AnnotationsLocked|nopanel=true}| |[AutoFormatOverride|DocumentProtection.AutoFormatOverride]|{excerpt-include:DocumentProtection.AutoFormatOverride|nopanel=true}| |[DocumentProtected|DocumentProtection.DocumentProtected]|{excerpt-include:DocumentProtection.DocumentProtected|nopanel=true}| |[EnforceDocumentProtection|DocumentProtection.EnforceDocumentProtection]|{excerpt-include:DocumentProtection.EnforceDocumentProtection|nopanel=true}| |[SelectOnlyFormFields|DocumentProtection.SelectOnlyFormFields]|{excerpt-include:DocumentProtection.SelectOnlyFormFields|nopanel=true}| |[StylesLocked|DocumentProtection.StylesLocked]|{excerpt-include:DocumentProtection.StylesLocked|nopanel=true}| {classes} ||Name||Description|| |[ProtectionLevel|DocumentProtection.ProtectionLevel]|{excerpt-include:DocumentProtection.ProtectionLevel|nopanel=true}|
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