Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

你可以在控件中保护工作表,或者锁定单元格。

使用 isProtected 方法来保护工作表;使用 cell 上的 locked 方法来锁定单元格。

但是如果 isProtected 为 false,单元格仍然能被编辑。

保护工作表旨在防止单元格被编辑。如果你只希望用户编辑某些单元格,那么你可以将工作表保护起来,并解除特定单元格的锁定状态。

在单元格被保护时,数据是可以被拷贝出来的。

options.protectionOptions 属性可以用来指定你想让用户编辑哪些区域。可控制的属性包括重设大小,筛选等等。

示例代码
以下代码会解锁某些单元格。

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;

 

  • No labels