直到几周前,workbook protection API才在Excel Online中运行。现在它将错误作为无效参数。
我设置allowInsertColumns: false
和allowFormatCells: false
。
我的代码如下所示:
Excel.run(function (ctx) {
var sheet = ctx.workbook.worksheets.getItem("Sheet1");
var range = sheet.getRange("A1:B3").format.protection.locked = false;
sheet.protection.protect({
allowInsertColumns: false,
allowFormatCells: false
});
$('#mytestlabel1').text("Execution of protect api call is complete");
return ctx.sync().then(function () {
$('#mytestlabel').text("Sync operation is complete");
});
}).catch(function (error) {
$('#mytestlabel').text(error.message);
console.log("Error: " + error);
if (error instanceof OfficeExtension.Error) {
console.log("Debug info: " + JSON.stringify(error.debugInfo));
}
});
ctx.sync
完成后我得到了异常
有人知道发生了什么变化,以及如何解决这个问题?
答案 0 :(得分:0)
产品团队了解此问题并正在修复此问题。
有关详细信息,请参阅https://github.com/OfficeDev/office-js-docs/issues/1185。