[英]Excel protect workbook with password but allow readonly
Using the interop classes in C# I was able to protect a workbook for reading and writing with a password. 使用C#中的interop类,我可以保护工作簿以使用密码进行读写。
But I want users to be able to open the sheet as read-only. 但我希望用户能够以只读方式打开工作表。
Is this possible without using the Workbook.SaveAs
method? 如果不使用Workbook.SaveAs
方法,是否有可能?
Protecting a workbook with a password (picture 1) I'm using the Workbook.Password
property. 用密码保护工作簿(图1)我正在使用Workbook.Password
属性。
According to MSDN , the only way to change the Workbook.ReadOnlyRecommended
property is with the Workbook.SaveAs
method. 根据MSDN ,更改Workbook.ReadOnlyRecommended
属性的唯一方法是使用Workbook.SaveAs
方法。
In needed precisely what you're looking for a while ago (ie setting it without saving), but had to give in and use SaveAs
. 正是需要您前一段时间要查找的内容(即不保存即进行设置),但必须让步并使用SaveAs
。 To my knowledge it's the only way. 据我所知,这是唯一的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.