Document.ProtectionType A propriedade (sistema de 2007)

Obtém o tipo de proteção para o documento.

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

Sintaxe

Public ReadOnly Property ProtectionType As WdProtectionType

Dim instance As Document
Dim value As WdProtectionType

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

Valor de propriedade

Tipo: Microsoft.Office.Interop.Word.WdProtectionType
O tipo de proteção retornado pode ser uma da seguir WdProtectionType constantes: wdAllowOnlyComments, wdAllowOnlyFormFields, wdAllowOnlyReading, wdAllowOnlyRevisions, ou wdNoProtection.

Exemplos

O exemplo de código a seguir verifica se a proteção foi definida para o documento.Caso contrário, o código define a proteção para permitir somente comentários.

Este exemplo é para uma personalização em nível de documento.

PrivateSub DocumentProtectionType()
    IfMe.ProtectionType = Microsoft.Office.Interop.Word.WdProtectionType.wdNoProtection ThenMe.Protect(Microsoft.Office.Interop.Word.WdProtectionType.wdAllowOnlyComments)
    EndIfEndSub
privatevoid 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);
    }
}

Permissões

Consulte também

Referência

Document Classe

Membros Document

Namespace Microsoft.Office.Tools.Word