Workbook Protection stopped working with Excel Online

邮差的信 提交于 2019-12-24 07:58:37

问题


Until a few weeks ago, the workbook protection API was working in Excel Online. Now it gives error as invalid parameter.

I'm setting allowInsertColumns: false and allowFormatCells: false.

My code looks like this:

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));
    }

});

I get exception when ctx.sync is done

Does anybody know what has changed, and how to fix this?


回答1:


The product team is aware of this issue and is working on a fix.

See https://github.com/OfficeDev/office-js-docs/issues/1185 for details.



来源:https://stackoverflow.com/questions/47100262/workbook-protection-stopped-working-with-excel-online

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!