原文地址:http://www.evget.com/zh-CN/Info/catalog/18013.html
Microsoft Word和Excel都能够帮助你保护你的文档的安全。所以很多的文档有密码和writepassword属性功能。Edraw Office Viewer Component 组件可以使开发人员打开一个密码保护文档而没有提醒消息框。该组件支持无缝集成与Office 97,Office 2000,Office 2003,Office 2007和Office 2010。
密码保护提醒对话框
WritePassword保护提醒对话框
删除两个保护对话框的步骤如下:
您可以在调用Open方法之前,使用SetValue方法为Word和Excel文件设置密码和writepassword属性。 最好是在BeforeDocumentOpened事件或NotifyCtrlReady事件中添加SetValue方法。
boolean SetValue([in] BSTR Name, [in] BSTR Value)
设置文档的密码,writepassword、域和protectmodereminder。
Name: The name string.
Value: The value string.
例如:
以下vbscript展示了如何打开一个有密码保护的文档。该1.docx文件的密码是1234,writepassword 是5678,您可以使用以下实例:
Sub SetValue_Example()
EDOffice.SetValue "Password", "1234"
EDOffice.SetValue "WritePassword", "5678"
EDOffice.Open "c:\1.xls"
End Sub