Protection"

From Documentation
Line 1: Line 1:
 
= Protect a Sheet =  
 
= Protect a Sheet =  
how to enable / disable protection for a sheet with API , protectSheet()
+
If you enable "Protect Sheet" for a sheet in Excel (e.g. click [[File:zss-essentials-protection-excel-icon.png]] of menu "Review" in Excel 2007), Spreadsheet can read the setting and prevent you from editing the protected sheet. Spreadsheet's API also allow you to enable / disable protection and get protection status of a sheet. Let's use a simple example to demonstrate the usage:
  
 +
[[File:zss-essentials-protection.png | center]]
 +
The screenshot above is a simple application. There is a label showing current sheet's protection status. The '''true''' means the sheet is under protection and cannot be edited. The only one button can toggle protection status of current selected sheet.
 +
 +
<!--
 +
'''API example to enable/disable protection for a sheet'''
 +
<source lang='java'>
 +
//selectedSheet is a Sheet object
 +
//enable
 +
Ranges.range(selectedSheet).protectSheet("password");
 +
//disable
 +
Ranges.range(selectedSheet).protectSheet(null);
 +
</source>
 +
 +
'''API example to get protection status of a sheet'''
 +
<source lang='java'>
 +
sheet.isProtected();
 +
</source>
 +
-->
  
get protection status with API , isProtected()
 
  
 
= Unlock a Cell=
 
= Unlock a Cell=

Revision as of 03:04, 26 September 2013

Protect a Sheet

If you enable "Protect Sheet" for a sheet in Excel (e.g. click Zss-essentials-protection-excel-icon.png of menu "Review" in Excel 2007), Spreadsheet can read the setting and prevent you from editing the protected sheet. Spreadsheet's API also allow you to enable / disable protection and get protection status of a sheet. Let's use a simple example to demonstrate the usage:

Zss-essentials-protection.png

The screenshot above is a simple application. There is a label showing current sheet's protection status. The true means the sheet is under protection and cannot be edited. The only one button can toggle protection status of current selected sheet.


Unlock a Cell

Spreadsheet supports unlock cells of a protected sheet configured in Excel.

describe how to unlock a cell in Excel.

right click a cell, select "Format Cells...", select "Protection" tab, uncheck "Locked" item.