我要实现右键菜单一些功能 保留,有固定的几列不能编辑,但是这样谢了就所有的都不能编辑了
var protectedOptions = {
allowSelectLockedCells:true,
allowSelectUnlockedCells:true,
allowFilter: false,
allowSort: false,
allowResizeRows: true,
allowResizeColumns: true,
allowEditObjects: false,
allowDragInsertRows: false,
allowDragInsertColumns: false,
allowInsertRows: false,
allowInsertColumns: false,
allowDeleteRows: true,
allowDeleteColumns: false
};
sheet.options.protectionOptions = protectedOptions;
sheet.options.isProtected = true;
var style = sheet.getDefaultStyle();
style.locked = false;
//设置分册名和产品型号两列不可编辑
var colcount = sheet.getColumnCount();
for (var j = 0; j < colcount; j++)
{
var colname = sheet.getValue(0, j, GC.Spread.Sheets.SheetArea.colHeader);
if ((colname == "分册名") || (colname == "产品型号") ||(colname == "产品类型")){
sheet.setStyle(-1, j, style);
sheet.getCell(-1, j).locked(true);
}
} |