仅适用于 Word 的 VSTO 插件

发布于 2024-07-12 03:46:14 字数 132 浏览 4 评论 0原文

我已经为 Word 2003 编写了一个可以正常工作的 VSTO 插件。 唯一的问题是该插件显示一个命令栏,当我在 Outlook 中创建新电子邮件时也会出现该命令栏。 如何防止命令栏插件在 Outlook 上下文中显示而仅在 Word 中显示?

I've written a VSTO addin for Word 2003 which is working correctly. The only problem is that the addin displays a commandbar which is also appearing when I create a new email in Outlook. How can I prevent the commandbar addin from displaying in the context of Outlook and only in Word?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

季末如歌 2024-07-19 03:46:14

您的问题是 Outlook 使用 Word 作为电子邮件编辑器。

您可以从 Outlook 中的“工具”“选项”“邮件格式”中关闭该功能,或者您可能需要进行检测,例如,如果是电子邮件,则 Document.Kind 属性的值为 wdDocumentEmail (=2)

Your problem is that Outlook is using Word as the editor for email messages.

You can turn that off from Tools Options Mail Format in Outlook, or you can will need to do detection, for instance the Document.Kind property, will have a value of wdDocumentEmail (=2) if it's an email message

森林散布 2024-07-19 03:46:14

我还没有尝试过这个,但是您可以使用 Word 实例的 Parent 属性来确定其父级是否是 Outlook,并且在这种情况下不显示命令栏?

I haven't tried this, but can you use the Parent property of the Word instance to determine if its parent is Outlook and in that case not display the commandbar?

变身佩奇 2024-07-19 03:46:14

父属性只是不断循环回 Microsoft Word,而绝不会循环回 Outlook。 我最终导入了 User32.dll 并获取了 Windows 名称,然后检查其中是否包含 Microsoft Word。

我仍然遇到的唯一问题是,如果用户打开 Outlook,创建新邮件,然后打开 Word,WINWORD.exe 进程仍然具有我假设的默认模板,因此新的副本单词将不会显示我的插件。

The parent property just keeps looping back to Microsoft Word, and never to Outlook. I ended up importing User32.dll and getting the windows name, and then checking to see if that contained Microsoft Word.

The only problem I am still having is that if a user opens Outlook, creates a new message, and then opens Word, the WINWORD.exe process still has what im assuming to be the default template, and therefore the new copy word will not show my plugin.

梦醒灬来后我 2024-07-19 03:46:14

Word 中有几个属性可以让您检测它是否作为邮件编辑器运行。

应用程序邮件信封
应用程序信封
App.Email

所有返回电子邮件相关信息。 我相信,如果单词不被用作电子邮件编辑器,那么至少其中一个不会返回任何内容,但我无法再访问该代码,所以如果不尝试的话我无法确定。

也就是说,我确实知道即使 MS 也建议不要使用 Word 作为电子邮件编辑器。 在 Office 2007 和 2010 中,我认为这不再是一种选择。

There's several properties in Word that should let you detect whether it's being run as a mail editor or not.

App.MailEnvelope
App.Envelope
App.Email

All return email related information. I believe at least one of them will return NOTHING if word is NOT being used as an email editor, but I no longer have access to that code, so I couldn't be sure without trying it out.

That said, I do know that even MS recommends against using Word as email editor. in Office 2007 and 2010, I don't believe that's even an option anymore.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文