[Table of Contents] [docx version]
SpreadsheetML Reference Material - Table of Contents
sheetProtection (Sheet Protection Options)
This collection expresses the sheet protection options to enforce when the sheet is protected.
[Example:
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"/>
end example]
Parent Elements |
dialogsheet (§3.3.1.32); worksheet (§3.3.1.96) |
Attributes |
Description |
autoFilter (AutoFilter Locked) |
Autofilters are locked when the sheet is protected.
The possible values for this attribute are defined by the XML Schema boolean datatype. |
deleteColumns (Delete Columns Locked) |
Deleting columns is locked when the sheet is protected.
The possible values for this attribute are defined by the XML Schema boolean datatype. |
deleteRows (Delete Rows Locked) |
Deleting rows is locked when the sheet is protected.
The possible values for this attribute are defined by the XML Schema boolean datatype. |
formatCells (Format Cells Locked) |
Formatting cells is locked when the sheet is protected.
The possible values for this attribute are defined by the XML Schema boolean datatype. |
formatColumns (Format Columns Locked) |
Formatting columns is locked when the sheet is protected.
The possible values for this attribute are defined by the XML Schema boolean datatype. |
formatRows (Format Rows Locked) |
Formatting rows is locked when the sheet is protected.
The possible values for this attribute are defined by the XML Schema boolean datatype. |
insertColumns (Insert Columns Locked) |
Inserting columns is locked when the sheet is protected.
The possible values for this attribute are defined by the XML Schema boolean datatype. |
insertHyperlinks (Insert Hyperlinks Locked) |
Inserting hyperlinks is locked when the sheet is protected.
The possible values for this attribute are defined by the XML Schema boolean datatype. |
insertRows (Insert Rows Locked) |
Inserting rows is locked when the sheet is protected.
The possible values for this attribute are defined by the XML Schema boolean datatype. |
objects (Objects Locked) |
Objects are locked when the sheet is protected.
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 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 revisionsPassword attribute of §3.2.29.
The resulting value is hashed using the algorithm defined below.
[Note: 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); } end note]
The possible values for this attribute are defined by the ST_UnsignedShortHex simple type (§3.18.87). |
pivotTables (Pivot Tables Locked) |
Pivot tables are locked when the sheet is protected.
The possible values for this attribute are defined by the XML Schema boolean datatype. |
scenarios (Scenarios Locked) |
Scenarios are locked when the sheet is protected.
The possible values for this attribute are defined by the XML Schema boolean datatype. |
selectLockedCells (Select Locked Cells Locked) |
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. |
selectUnlockedCells (Select Unlocked Cells Locked) |
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 (Sheet Locked) |
Sheet is locked when the sheet is protected.
The possible values for this attribute are defined by the XML Schema boolean datatype. |
sort (Sort Locked) |
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>