Condividi tramite


Proprietà Document.ProtectionType (System 2007)

Aggiornamento: novembre 2007

Ottiene il tipo di protezione per il documento.

Spazio dei nomi:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)

Sintassi

Public ReadOnly Property ProtectionType As WdProtectionType

Dim instance As Document
Dim value As WdProtectionType

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

Valore proprietà

Tipo: Microsoft.Office.Interop.Word.WdProtectionType

Il tipo di protezione restituito può essere dato da una delle seguenti costanti WdProtectionType: wdAllowOnlyComments, wdAllowOnlyFormFields, wdAllowOnlyReading, wdAllowOnlyRevisions o wdNoProtection.

Esempi

Nell'esempio di codice riportato di seguito viene illustrato come controllare se per il documento è stata impostata la protezione. In caso contrario, la protezione viene impostata per consentire solo i commenti.

Questo esempio è per una personalizzazione a livello di documento.

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);
    }
}

Autorizzazioni

Vedere anche

Riferimenti

Document Classe

Membri Document

Spazio dei nomi Microsoft.Office.Tools.Word