“You are not allowed to edit this selection because it is protected.” but only since Office 2013?

后端 未结 8 1980
我寻月下人不归
我寻月下人不归 2021-02-19 20:07

We\'ve had these few lines of code running happily in our applications for several years (and in several versions of Office, 2003, 2007, 2010 etc). Purpose is to perform a kind

8条回答
  •  轮回少年
    2021-02-19 20:49

    In my case, this error was caused by the presence of content controls with .LockContentControl == true.

    To work around this issue, I built an IEnumerable of the content controls with this property set to true, and set .LockContentControl = false. Now I can .InsertColumnsRight() without a problem. Then I restore the .LockContentControl = true for all content controls in my collection.

提交回复
热议问题