简体   繁体   English

如何使用C#在Excel中禁用剪切,复制和粘贴选项?

[英]How to disable cut,copy and paste option in excel using c#?

I have tried the code shown below to disable cut,copy and paste option in excel using c#, but still I'm able to copy and paste. 我已经尝试过使用C#禁用Excel中的剪切,复制和粘贴选项,如下所示的代码,但是我仍然能够复制和粘贴。

Microsoft.Office.Interop.Excel.Worksheet wks =   (Microsoft.Office.Interop.Excel.Worksheet)wkb.Sheets[1];

wks.Application.CutCopyMode = (Microsoft.Office.Interop.Excel.XlCutCopyMode)0;

Any suggestions how to fix this problem? 任何建议如何解决此问题?

Well, as I got the same issue, I fixed it with the code used there: https://stackoverflow.com/a/46826429/7991036 好吧,当我遇到同样的问题时,我用那里使用的代码修复了它: https : //stackoverflow.com/a/46826429/7991036

It fixed definitely the issue for me! 它绝对为我解决了这个问题!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM