如何为应用程序的每个实例再次加载加载项?

发布于 2024-08-20 13:23:08 字数 405 浏览 4 评论 0原文

我有一个问题。我在 c#.net 中创建了一个共享加载项。这个插件工作正常。现在我希望在打开任何 Office 应用程序时再次加载此加载项。例如,当我打开任何 MS Word 文档时,将加载该加载项,如果此后我打开另一个 MS Word 文档而不关闭以前打开的文档,则将再次加载新打开的 MS Word 文档的加载项。但是,当我第一次打开 MS Word 时,加载项已加载,如果我再次打开 MS Word 但加载项已加载。

我的要求是这样的 - 我的加载项是在后台工作的,它的工作只是记录Word文档的打开、关闭时间以及在该Word文档上花费的时间以及该文档的名称。但是,当我打开一个 Word 文档时,就会加载该加载项,如果再次打开新的 Word 文档,那么因为之前打开的文档加载项不会加载该文档,请记住,以前打开的文档并未关闭。但如果我关闭以前打开的文档,则加载新文档加载项。

I have one qus. i created one shared add-in in c#.net. This add-in is working fine. now i want this add-in is load again n again when any office application is opened. For e.g. when i open any MS word document then add-in is load for that and if after that i opened another MS word document without closing previously opened document then add-in is again load for newly opend MS word document. But when i opened MS word at first time the add-in is load and if i opened MS word again but add-in is already loaded.

my requirement is like that-my add-in is worked backgroundly that is its work only to record the opening,closing time of the word document and how much time spend onto that word document and also the name of this document. But when i opened one word document then add-in is loaded for that and if againg opened new word document then becaz of previously opened document add-in is not load for that document remember that priviously opened document is not closed. but if i closed previously opened document then for new document add-in is load.

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

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

发布评论

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

评论(1

坏尐絯 2024-08-27 13:23:08

插件的应用范围很广无法按文档加载/卸载它。为了捕获文档打开/关闭,您可以从 Application 类中挂钩适当的事件

编辑:我没有使用过 C#。但是,这是我的建议(基于我对 VBA 的理解)。
您必须声明&保存 Application 类的实例变量。
订阅DocumentBeforeCloseDocumentOpen等事件有适当的结构来保存文档的完整路径根据事件打开/关闭的时间。

它是否为您提供了有关您正在尝试做的事情的足够信息?

Addin are application wide & it can't be loaded/unloaded per document. In order to catch the document open/close, you could hook into the appropriate event from the Application class

EDIT: I haven't used c#. But, here is what I suggest (based on my VBA understanding).
You will have to declare & hold an instance variable of the Application class.
Subscribe to the events such as DocumentBeforeClose and DocumentOpen & have appropriate structure to hold the fullpath of the document & time of open/close as per the events.

Does it give you enough info on what you are trying to do?

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