다음을 통해 공유


ChartSheetProtection.Password Property

Definition

Password

Represents the following attribute in the schema: 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

Property Value

Returns StringValue.

Attributes

Remarks

The following information from the ECMA International Standard ECMA-376 can be useful when working with this class.

Specifies the hash of the password required for editing this chart sheet. This protection is optional and may be ignored by applications that choose not to support this functionality. The hash is generated from an 8-bit wide character. 16-bit Unicode characters must be converted down to 8 bits before the hash is computed, using the logic defined in the revisionsPassword attribute of the workbookProtection element.

The resulting value is hashed using the algorithm defined below.

An example algorithm to hash the user input into the value stored is as follows:

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

The possible values for this attribute are defined by the ST_UnsignedShortHex simple type.

Applies to