<sheetProtection> (Chart Sheet Protection)

This collection expresses the chart sheet protection options to enforce when the chart sheet is protected.

Parent Elements

<chartsheet>3.3.1.11)

Attributes

Description

<content> (Contents)

When true prevents users from making changes to items that are part of the chart, such as data series, axes, and legends. The chart continues to reflect changes made to its source data.

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

<objects> (Objects Locked)

When true prevents users from making changes to graphic objects— including shapes, text boxes, and controls— unless you unlock the specific objects before you protect the chart sheet.

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

<password> (Password)

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 @revisionPassword attribute of §3.2.29.

The resulting value is hashed using the algorithm defined below.

Note:
// 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 (§3.18.87).

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

<complexType name="CT_ChartsheetProtection">
	<attribute name="password" type="ST_UnsignedShortHex" use="optional"/>
	<attribute name="content" type="xsd:boolean" use="optional" default="false"/>
	<attribute name="objects" type="xsd:boolean" use="optional" default="false"/>
</complexType>