Forums     Knowledge Base     OfficeWriter Online     
 
 
This documentation is for
OfficeWriter v3.8.1
.NET Platform

View Docs for Another
Version or Platform

Programmer's Reference > WordApplication API > DocumentProtection

The DocumentProtection Object


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

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.



Examples:

[csharp]
WordApplication app = new WordApplication();
 Document doc = app.Create();
 DocumentProtection docProtect = doc.DocumentProtection;
[vbnet]
Dim app As New WordApplication()
 Dim doc As Document = app.Create()
 Dim docProtect As DocumentProtection = doc.DocumentProtection


DocumentProtection Enumerations

NameDescription
DocumentProtection.ProtectionLevel

A DocumentProtection.ProtectionLevel value specifies what type of editing is allowed in the document



DocumentProtection Properties

Property Type Access Description
AnnotationsLocked boolean read
write

Sets or returns a boolean representing whether or not annotations are locked in this document

AutoFormatOverride boolean read
write

Sets or returns a boolean representing whether or not Word will autoformat to override a style lock down in this document

DocumentProtected DocumentProtection.ProtectionLevel read
write

Sets or returns a protection level for the document

EnforceDocumentProtection boolean read
write

Sets or returns a boolean representing whether or not Word will enforce document protection in this document

SelectOnlyFormFields boolean read
write

Sets or returns a boolean representing whether or not Word will only allow selections in form fields for this document

StylesLocked boolean read
write

Sets or returns a boolean representing whether or not Word will lock the Styles in this document



This object does not have any methods defined.



Copyright 2007 © SoftArtisans, Inc. All Rights Reserved.