使用C#中的interop类,我可以保护工作簿以使用密码进行读写.
Using the interop classes in C# I was able to protect a workbook for reading and writing with a password.
但是我希望用户能够以只读方式打开工作表.
But I want users to be able to open the sheet as read-only.
是否可以不使用 Workbook.SaveAs 方法?
Is this possible without using the Workbook.SaveAs method?
使用密码保护工作簿(图1)我正在使用 Workbook.Password 属性.
Protecting a workbook with a password (picture 1) I'm using the Workbook.Password property.
推荐答案根据 MSDN ,更改Workbook.ReadOnlyRecommended属性的唯一方法是使用Workbook.SaveAs方法.
According to MSDN, the only way to change the Workbook.ReadOnlyRecommended property is with the Workbook.SaveAs method.
In恰好需要您不久前要查找的内容(即在不保存的情况下进行设置),但必须让步并使用SaveAs.据我所知,这是唯一的方法.
In needed precisely what you're looking for a while ago (i.e. setting it without saving), but had to give in and use SaveAs. To my knowledge it's the only way.
更多推荐
Excel使用密码保护工作簿,但允许只读
发布评论