Compartir a través de


DocumentBase.ProtectionType (Propiedad)

Obtiene el tipo de protección para el documento.

Espacio de nombres:  Microsoft.Office.Tools.Word
Ensamblado:  Microsoft.Office.Tools.Word.v4.0.Utilities (en Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Sintaxis

'Declaración
Public ReadOnly Property ProtectionType As WdProtectionType
public WdProtectionType ProtectionType { get; }

Valor de propiedad

Tipo: Microsoft.Office.Interop.Word.WdProtectionType
El tipo de protección devuelto puede ser una de las constantes WdProtectionType siguientes: wdAllowOnlyComments, wdAllowOnlyFormFields, wdAllowOnlyReading, wdAllowOnlyRevisions o wdNoProtection.

Ejemplos

En el ejemplo de código siguiente se comprueba si se ha establecido la protección para el documento.Si no, el código establece la protección de modo que sólo se permitan comentarios.Para usar este ejemplo, ejecútelo desde la clase ThisDocument en un proyecto de nivel de 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);
    }
}

Seguridad de .NET Framework

Vea también

Referencia

DocumentBase Clase

Microsoft.Office.Tools.Word (Espacio de nombres)