DocumentBase.Password 属性

定义

设置一个为打开文档而必须提供的密码。

public string Password { set; }

属性值

String

一个为打开文档而必须提供的密码。

示例

下面的代码示例将文档的密码设置为用户传入的文本。 若要使用此示例,请在 ThisDocument 文档级项目的类中运行它。

private void DocumentPassword(string PasswordFromUser)
{
    this.Password = PasswordFromUser;
}
Private Sub DocumentPassword(ByVal PasswordFromUser As String)
    Me.Password = PasswordFromUser
End Sub 

注解

避免在应用程序中使用硬编码的密码。 如果过程中需要密码,请从用户请求密码,将其存储在变量中,然后在代码中使用该变量。

适用于