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
Wiki Markup
{description}
{excerpt}This class is used to get and set document protection settings for a document.{excerpt}
{signature:C#}
 public sealed class DocumentProtection
{signature}{signature:vb.net}
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#}

          WordApplication app = new WordApplication();
          Document doc = app.Create();
          DocumentProtection docProtect = doc.DocumentProtection;
        {code}
{code:vb.net|title=vb.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}|