开发者

how to Add-in load again n again for every instance of an application?

开发者 https://www.devze.com 2022-12-19 19:38 出处:网络
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

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 do开发者_Python百科cument is not closed. but if i closed previously opened document then for new document add-in is load.


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?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号