Spread.Sheets Documentation > Developer's Guide > Managing the User Interface > Using Protect and Cell Locking |
You can protect the sheet and lock cells in the widget.
Use the isProtected method to protect the sheet and the locked method to lock a cell.
Cells can still be edited if the sheet isProtected method is false.
Protecting the sheet prevents cells from being edited. If you wish to allow the user to edit specific cells, protect the sheet and unlock only the cells you want the user to edit.
Data can be copied from locked cells.
The options.protectionOptions property can be used to specify what areas you want the user to be allowed to change. Areas can include resizing rows or columns, filtering, and so on.
This example unlocks a cell.
JavaScript |
Copy Code
|
---|---|
sheet.getCell(1,1, GC.Spread.Sheets.SheetArea.viewport).locked(false); sheet.setValue(1,1,"unLocked"); sheet.getRange(-1,3, -1, 1).locked(false); sheet.getRange(5, -1, 1, -1).locked(false); sheet.options.isProtected = true; |