<sheetProtection>
(Sheet Protection Options)
This collection expresses the sheet protection options to enforce when the sheet is protected.
This example demonstrates that the sheet is protected, objects and scenarios may be edited, and
<sheetProtection sheet="1" objects="1" scenarios="1" formatCells="0" selectLockedCells="1"/>
Attributes |
Description |
---|---|
|
Autofilters are locked when the sheet is protected. The possible values for this attribute are defined by the XML Schema boolean datatype. |
|
Deleting columns is locked when the sheet is protected. The possible values for this attribute are defined by the XML Schema boolean datatype. |
|
Deleting rows is locked when the sheet is protected. The possible values for this attribute are defined by the XML Schema boolean datatype. |
|
Formatting cells is locked when the sheet is protected. The possible values for this attribute are defined by the XML Schema boolean datatype. |
|
Formatting columns is locked when the sheet is protected. The possible values for this attribute are defined by the XML Schema boolean datatype. |
|
Formatting rows is locked when the sheet is protected. The possible values for this attribute are defined by the XML Schema boolean datatype. |
|
Inserting columns is locked when the sheet is protected. The possible values for this attribute are defined by the XML Schema boolean datatype. |
|
Inserting hyperlinks is locked when the sheet is protected. The possible values for this attribute are defined by the XML Schema boolean datatype. |
|
Inserting rows is locked when the sheet is protected. The possible values for this attribute are defined by the XML Schema boolean datatype. |
|
Objects are locked when the sheet is protected. The possible values for this attribute are defined by the XML Schema boolean datatype. |
|
Specifies the hash of the password required for editing this worksheet. 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 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). |
|
Pivot tables are locked when the sheet is protected. The possible values for this attribute are defined by the XML Schema boolean datatype. |
|
Scenarios are locked when the sheet is protected. The possible values for this attribute are defined by the XML Schema boolean datatype. |
|
Selection of locked cells is locked when the sheet is protected. The possible values for this attribute are defined by the XML Schema boolean datatype. |
|
Selection of unlocked cells is locked when the sheet is protected. The possible values for this attribute are defined by the XML Schema boolean datatype. |
|
Sheet is locked when the sheet is protected. The possible values for this attribute are defined by the XML Schema boolean datatype. |
|
Sorting is locked when the sheet is protected. The possible values for this attribute are defined by the XML Schema boolean datatype. |
The following XML Schema fragment defines the contents of this element:
<complexType name="CT_SheetProtection">
<attribute name="password" type="ST_UnsignedShortHex" use="optional"/>
<attribute name="sheet" type="xsd:boolean" use="optional" default="false"/>
<attribute name="objects" type="xsd:boolean" use="optional" default="false"/>
<attribute name="scenarios" type="xsd:boolean" use="optional" default="false"/>
<attribute name="formatCells" type="xsd:boolean" use="optional" default="true"/>
<attribute name="formatColumns" type="xsd:boolean" use="optional" default="true"/>
<attribute name="formatRows" type="xsd:boolean" use="optional" default="true"/>
<attribute name="insertColumns" type="xsd:boolean" use="optional" default="true"/>
<attribute name="insertRows" type="xsd:boolean" use="optional" default="true"/>
<attribute name="insertHyperlinks" type="xsd:boolean" use="optional" default="true"/>
<attribute name="deleteColumns" type="xsd:boolean" use="optional" default="true"/>
<attribute name="deleteRows" type="xsd:boolean" use="optional" default="true"/>
<attribute name="selectLockedCells" type="xsd:boolean" use="optional" default="false"/>
<attribute name="sort" type="xsd:boolean" use="optional" default="true"/>
<attribute name="autoFilter" type="xsd:boolean" use="optional" default="true"/>
<attribute name="pivotTables" type="xsd:boolean" use="optional" default="true"/>
<attribute name="selectUnlockedCells" type="xsd:boolean" use="optional" default="false"/>
</complexType>