<protectedRange> (Protected Range)

A specified range to be protected. Ranges listed here are protected only when the sheet protection is ON and the cell is flagged as being locked. If no password is specified here, then read/write permissions are automatically given to all users, regardless of additional security descriptor information. In other words, the security descriptor information (specific types of access) at the user level is only applied if a password for this range is specified.

When a password is specified, then users not listed specifically as having access should be prompted with a password. If that user supplies the correct password, then they may edit the range or cell in question. This protection is optional and may be ignored by applications who choose not to support this functionality.

Parent Elements




<name> (Name)

Range title. This is used as a descriptor, not as a named range definition.

The possible values for this attribute are defined by the ST_Xstring simple type (§3.18.96).

<password> (Password)

Specifies the hash of the password required for editing this range. 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 §3.2.29.

The resulting value is hashed using the algorithm defined below.

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

The possible values for this attribute are defined by the ST_UnsignedShortHex simple type (§3.18.87).

<securityDescriptor> (Security Descriptor)

Optional setting to specify the relative security descriptor. The security descriptor defines user accounts who may edit this range without providing a password to access the range. Removing this attribute shall remove all permissions granted or denied to users for this range.

The possible values for this attribute are defined by the XML Schema string datatype.

<sqref> (Sequence of References)

The range to be protected.

The possible values for this attribute are defined by the ST_Sqref simple type (§3.18.78).

The following XML Schema fragment defines the contents of this element:

<complexType name="CT_ProtectedRange">
	<attribute name="password" type="ST_UnsignedShortHex" use="optional"/>
	<attribute name="sqref" type="ST_Sqref" use="required"/>
	<attribute name="name" type="ST_Xstring" use="required"/>
	<attribute name="securityDescriptor" type="xsd:string" use="optional"/>