本帖最后由 鸳鸯配2024 于 2024-8-14 09:54 编辑
sheet.options.isProtected = true;
加了后,就是全局全部不可编辑,可我只想要部分不可编辑
list = [{
colCount: 0
columnEndNumber: 4
columnStartNumber: 3
rowCount: 7
rowEndNumber: 11
rowStartNumber: 3
}]
const noPreviewable = (list) =>{
let Designer = GC.Spread.Sheets.Designer.findControl('designer-container')
let spread = Designer.getWorkbook()
let sheet = spread.getActiveSheet();
sheet.options.isProtected = true;
console.log(sheet, '--designer666--', list)
let style = new GC.Spread.Sheets.Style();
style.locked = false;
list.forEach(v=>{
v.rowCount = v.rowEndNumber - v.rowStartNumber-1
v.colCount = v.columnEndNumber - v.columnStartNumber-1
for (let i = 0; i <= v.colCount; i++) {
for (let j = 0; j <= v.rowCount; j++) {
console.log(i, '---只想要这里面的方法不生效---', j)
sheet.setStyle(v.rowStartNumber + j, v.columnStartNumber + i, style, GC.Spread.Sheets.SheetArea.viewport);
// sheet.getCell(v.rowStartNumber + j, v.columnStartNumber + i).locked(false);
}
}
})
}
|
|