Freigeben über


Document.ProtectionType-Eigenschaft (2007 System)

Aktualisiert: November 2007

Ruft den Schutztyp für das Dokument ab.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)

Syntax

Public ReadOnly Property ProtectionType As WdProtectionType

Dim instance As Document
Dim value As WdProtectionType

value = instance.ProtectionType
public WdProtectionType ProtectionType { get; }

Eigenschaftenwert

Typ: Microsoft.Office.Interop.Word.WdProtectionType

Bei dem zurückgegebenen Schutztyp kann es sich um eine der folgenden WdProtectionType-Konstanten handeln: wdAllowOnlyComments, wdAllowOnlyFormFields, wdAllowOnlyReading, wdAllowOnlyRevisions oder wdNoProtection.

Beispiele

Im folgenden Codebeispiel wird überprüft, ob für das Dokument Schutz festgelegt wurde. Wenn nicht, legt der Code Schutz fest, sodass nur Kommentare zugelassen sind.

Dieses Beispiel bezieht sich auf eine Anpassung auf Dokumentebene.

Private Sub DocumentProtectionType()
    If Me.ProtectionType = Microsoft.Office.Interop.Word.WdProtectionType.wdNoProtection Then
        Me.Protect(Microsoft.Office.Interop.Word.WdProtectionType.wdAllowOnlyComments)
    End If
End Sub 
private void DocumentProtectionType()
{
    if (this.ProtectionType == Microsoft.Office.Interop.
        Word.WdProtectionType.wdNoProtection)
    {
        this.Protect(Microsoft.Office.Interop.Word.
            WdProtectionType.wdAllowOnlyComments, 
            ref missing, ref missing, ref missing,
            ref missing);
    }
}

Berechtigungen

Siehe auch

Referenz

Document-Klasse

Document-Member

Microsoft.Office.Tools.Word-Namespace