Excel使用密码保护工作簿,但允许只读

编程入门 行业动态 更新时间:2024-10-09 10:29:12
本文介绍了Excel使用密码保护工作簿,但允许只读的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

使用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使用密码保护工作簿,但允许只读

本文发布于:2023-11-01 01:10:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1547808.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:密码保护   工作   Excel

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!