The entire worksheet is not editable after protect the sheet with some locked cells

时光怂恿深爱的人放手 提交于 2019-12-11 16:11:59

问题


I have issue with protect worksheet in excel online. I will unlock all of the cells in the worksheet, and lock one range, then protect worksheet, after that nothing is editable in the worksheet, even the cells are unlocked.This issue only happens for excel online version, works fine for installed desktop version. Anyone has idea how to solve the problem or the is an officeJs bug?

Excel.run(function (ctx) {
  //Worksheet
  var sheet = ctx.workbook.worksheets.getItem("Sheet1");

  //Entire Range
  var entireRange = sheet.getRange();
  entireRange.format.protection.locked = false;  

  //Specific Range
  var range = sheet.getRange("A1:B5");  

  range.format.protection.locked = false;

//Protect Entire sheet
      sheet.protection.protect({
        allowInsertRows: false,
        allowDeleteRows: false
      });

  return ctx.sync();

}).catch(errorHandler);

回答1:


This should be an issue of Office-Js API. We Office-Js API team are looking into this issue. We are tracking it by internal bug 2542108.

The worksheet will recover to editable state when user refreshes the page. I'm afraid there's no workaround you can do from API side currently.




回答2:


the issue is fixed now, this should no longer happen.



来源:https://stackoverflow.com/questions/52189194/the-entire-worksheet-is-not-editable-after-protect-the-sheet-with-some-locked-ce

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