1金币
在官网的导入文件后做如下修改,并不能实现根据某列的值决定一行的编辑权限- if (fileType === "sjs") {
- spread.open(
- file,
- function () {},
- function () {},
- options
- );
- } else {
- spread.import(
- file,
- function () {
- let colIndex = 8,
- sheet = spread.getSheetFromName("Basic Information");
- const rc = sheet.getRowCount();
- for (let i = 0; i < rc; i++) {
- console.log(
- i,
- sheet.getValue(i, colIndex),
- typeof sheet.getValue(i, colIndex),
- Number(sheet.getValue(i, colIndex))
- );
- console.log(i, Number(sheet.getValue(i, colIndex)) === 0);
- if (Number(sheet.getValue(i, colIndex)) === 0) {
- const defaultStyle = sheet.getDefaultStyle();
- defaultStyle.locked = false;
- sheet.setDefaultStyle(defaultStyle);
- const range = sheet.getRange(i, -1, 1, -1);
- range.locked(true);
- sheet.options.isProtected = true;
- }
- }
- },
- function () {},
- options
- );
- }
复制代码
|
|