spread.sheets.forEach(function(sheet) {
sheet.options.isProtected = false;
sheet.options.protectionOptions = {
allowSelectLockedCells : false,
allowSelectUnlockedCells : false,
};
sheet.options.isProtected = true; //出错 Uncaught TypeError: Cannot read property 'save' of null
});
for (let i = 0; i < spread.getSheetCount(); i++) {
spread.setActiveSheetIndex(i);
let tmpSheet = spread.getActiveSheet();
tmpSheet.options.isProtected = false;
tmpSheet.options.protectionOptions = {
allowSelectLockedCells : false,
allowSelectUnlockedCells : false,
};
tmpSheet.options.isProtected = true; //这样就好使
}
|
|