ChartSheetProtection.Password 属性

定义

Password

表示架构中的以下属性:password

[DocumentFormat.OpenXml.SchemaAttr(0, "password")]
public DocumentFormat.OpenXml.HexBinaryValue Password { get; set; }
public DocumentFormat.OpenXml.HexBinaryValue Password { get; set; }
[DocumentFormat.OpenXml.SchemaAttr(0, "password")]
public DocumentFormat.OpenXml.HexBinaryValue? Password { get; set; }
[DocumentFormat.OpenXml.SchemaAttr("password")]
public DocumentFormat.OpenXml.HexBinaryValue? Password { get; set; }
public DocumentFormat.OpenXml.HexBinaryValue? Password { get; set; }
member this.Password : DocumentFormat.OpenXml.HexBinaryValue with get, set
[<DocumentFormat.OpenXml.SchemaAttr(0, "password")>]
member this.Password : DocumentFormat.OpenXml.HexBinaryValue with get, set
[<DocumentFormat.OpenXml.SchemaAttr("password")>]
member this.Password : DocumentFormat.OpenXml.HexBinaryValue with get, set
Public Property Password As HexBinaryValue

属性值

返回 StringValue

属性

注解

使用此类时,ECMA 国际标准 ECMA-376 中的以下信息可能很有用。

指定编辑此图表工作表所需的密码哈希。 此保护是可选的,可能会被选择不支持此功能的应用程序忽略。 哈希是从 8 位宽字符生成的。 在计算哈希之前,必须使用 元素 的 属性workbookProtectionrevisionsPassword定义的逻辑,将 16 位 Unicode 字符转换为 8 位。

使用下面定义的算法对生成的值进行哈希处理。

将用户输入哈希到存储的值的示例算法如下所示:

// Function Input:  
//    szPassword: NULL-terminated C-style string  
//    cchPassword: The number of characters in szPassword (not including the NULL terminator)  
WORD GetPasswordHash(const CHAR *szPassword, int cchPassword) {  
      WORD wPasswordHash;  
      const CHAR *pch;  

      wPasswordHash = 0;  

      if (cchPassword > 0)  
            {  
            pch = &szPassword[cchPassword];  
            while (pch-- != szPassword)  
                  {  
                  wPasswordHash = ((wPasswordHash >> 14) & 0x01) | ((wPasswordHash << 1) & 0x7fff);  
                  wPasswordHash ^= *pch;  
                  }  
            wPasswordHash ^= (0x8000 | ('N' << 8) | 'K');  
            }  

      return(wPasswordHash);  
}  

此属性的可能值由 ST_UnsignedShortHex 简单类型定义。

适用于