如何知道Excel是从嵌入对象开始的? [英] How to know Excel was started from an embedded object?

查看:75
本文介绍了如何知道Excel是从嵌入对象开始的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello All,

Hello All,

我们正在与VSTO合作开展一个项目,我们有以下问题:

We are doing a project with VSTO and we have the following question:

有吗检测是否从嵌入式Excel对象启动Excel进程(或Excel应用程序对象)的方法?

在我们的示例中,Excel对象嵌入在Word中。

In our case the Excel object is embedded in Word.

我们已经查看了以下链接,但没有结果:

We already looked at the following link, but no result:

http://blogs.msdn.com/b/vsofficedeveloper/archive/2008/04/11/excel- ole-embedding-errors-with-managed-addin.aspx

谢谢......

祝你好运,

S

推荐答案

您可以查看被嵌入的工作簿的IsInPlace属性。如果为True,则表示Excel托管在某些应用程序中。通常,您也可以从Workbook.Container返回主机,但是我注意到,如果Excel作为嵌入对象打开(或者实际上是打开的话),那么
将会失败。因此,如果wb.InPlace = True并且您返回错误,尝试引用wb.Container会给出强烈的指示,您正在查看嵌入式工作簿。

You could look at the IsInPlace property of the Workbook beleived to be embedded. If True it means Excel is hosted in some application. Typically you would also be able to return the host from the Workbook.Container, however I notice that will fail if Excel is opened as an embedded object (or indeed if opened orinarily). So maybe If wb.InPlace = True and you return an error attempting to reference wb.Container would give a strong indication you are looking at an embedded workbook.

问候,

Peter Thornton

Regards,
Peter Thornton


这篇关于如何知道Excel是从嵌入对象开始的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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