如何在浏览器控件中以安全模式打开Excel文件并以只读方式打开? [英] How do I open Excel files in a browser control in safe mode and read-only?

查看:137
本文介绍了如何在浏览器控件中以安全模式打开Excel文件并以只读方式打开?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的VB6应用程序包含一个webbrowser控件,我可以在其中打开所有不同类型的文档。我希望能够以安全模式打开Excel文档(2003,2007和2010)(因为我发现加载项和其他自定义项可能导致程序崩溃
或至少需要很长时间才能加载)和只读,以便文档不会被更改。

My VB6 application includes a webbrowser control in which I open documents of all different types. I want to be able to open Excel documents (2003, 2007 and 2010) in safe mode (as I am finding the add-ins and other customizations can crash my program or at least take a long time to load) and read-only so that the documents are not changed.

我看到这可以使用Excel命令行开关完成,但我还没有找到通过webbrowser控件的Navigate2方法。它看起来似乎可以通过注册表BrowserFlags或EditFlags键进行配置,但是
除了如何启用/禁用在浏览器中显示文档之外,我没有找到关于这些标志的其他文档。

I see that this can be done using Excel command line switches, but I haven't found a way to pass those through via the webbrowser control's Navigate2 method. It also looks like this might be configurable via the registry BrowserFlags or EditFlags keys, but other than how to enable/disable showing the document in the browser or not, I've found no other documentation on these flags.

理想情况下,我想这样做只会影响我的应用程序,而不会影响机器上的任何其他Excel使用。我知道BrowserFlags设置是机器范围的。

Ideally, I'd like to do this so that it only affects my application, and not any other use of Excel on the machine. I do know that the BrowserFlags setting is machine wide.

谢谢!

推荐答案

Hello KevinKlasman , 

感谢您的发布。要在WebBrowser中显示Excel文档,我们需要修改注册表值。有关详细信息,请参阅以下两篇知识库文章:

Thanks for posting. To make Excel documents show in WebBrowser, we need to modify the registry values. For more information, please see these two KB articles:

如何使用WebBrowser控件打开Office文档:

http://support.microsoft.com/kb/243058

How to use the WebBrowser control to open an Office document:
http://support.microsoft.com/kb/243058.

当您尝试查看时会打开一个新窗口IE中的2007 Microsoft Office程序文档:

http://support.microsoft.com/kb/ 927009 /

A new window opens when you try to view a 2007 Microsoft Office program document in IE:
http://support.microsoft.com/kb/927009/.

在修改注册表值之前,请备份并恢复注册表。

Before modifying the registry values, please back up and restore the registry.

此处还有一个关于a的帖子类似的话题。希望它也可以帮到你:
http ://social.msdn.microsoft.com/Forums/en-US/exceldev/thread/87caab43-ed4f-4bb3-b362-7664c6526e54

Also here is a thread about a similar topic. Hope it also could help you: http://social.msdn.microsoft.com/Forums/en-US/exceldev/thread/87caab43-ed4f-4bb3-b362-7664c6526e54.

如果这篇文章没有不帮你,随便跟进。祝你有愉快的一天。

If this post does not help you, just feel free to follow up. Have a nice day.


这篇关于如何在浏览器控件中以安全模式打开Excel文件并以只读方式打开?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆