Is there a way to hook into an event when user accepts a revision on a single word in MS-Word VSTO addin?
Or generaly: Is there some general approach to hook into events initiated by actions of a user in ms-word?
Related
I work on an Outlook 2016 add-in (C# visual studio 2017 on Windows 10).
The add-in do its job perfectly when a new message is created and then sent from the "Write new message" window launched from the Outlook main menu (or toolbar) : the add-in displays its own ribbon with some radiobuttons to configure the message to be sent and that's all.
But when a new message window is created from the Windows contextual menu "Send to" on a file (to be sent as an attachement), the add-in is ignored : the radio buttons, even if they trigger their respective callbacks and so configure the underlying model, let the new message unchanged :-(
The main difference observed under debugger is :
from the outlook menu : the "ThisAddIn" class seems to retrieve a wrapper for the new message window and so the configuration is taken into account when the message is sent :-)
from the Windows contextual menu : only a "GetCustomUI" callback is triggered and so the message is sent unchanged when the "Send" button is clicked :-(
Any help (examples, documentation, howto, ...) appreciated ...
JF
Not all event handlers are triggered when users try to send files using the context menu Send To.
If the GetCustomUI is triggered when a user sends files from a folder (using a context menu) you can add a custom ribbon UI with your radio buttons to configure the message to be sent. I suppose that is all what your add-in does.
You just need to use Ribbon XML to create a custom UI and use the GetCustomUI function to return it back. Read more about that in the Walkthrough: Create a custom tab by using Ribbon XML article.
In the ribbon event handlers you need to make sure you get access to the item through the Context passed as an argument. For example, the onAction callback has the following signature:
C#: void OnAction(IRibbonControl control)
VBA: Sub OnAction(control As IRibbonControl)
C++: HRESULT OnAction([in] IRibbonControl *pControl)
Visual Basic: Sub OnAction(control As IRibbonControl)
The IRibbonControl interface instance provides the Context property which represents the active window containing the Ribbon user interface that triggers a callback procedure. So, you may cast it to the Inspector or Explorer for retrieving the actual mail item you have to deal with.
Found strange behavior that MailItem.SaveChanges triggers Explorer.SelectionChange event in our VSTO Outlook add-in. Is it normal and is there any way to avoid that?
We tried to use OutlookRedemption, but RDOMail.Save also triggers SelectionChange.
BTW, we are calling Save from a background thread for the item found by EntryId. Is it ok to do that? Or the same restriction to use Outlook objects from the main thread only applies here? I tried to marshal calls to the main thread, but it does not help with the SelectionChange issue.
I'm writing a VBE/VBIDE add-in and I have a tool window that changes based on the open CodePane objects. Is there an event I can monitor when a code pane is added or removed from the CodePanes collection?
The CodePanes collection itself appears to have no Events associated with it.
If there is no event available, I'm open to other workarounds. Polling would be a reliable fallback, but I'd rather not go that route if I could avoid it.
I'd like to write an Outlook add-in that would parse text being typed by the user.
The goal - if the user types a sequence of characters, the add-in would perform some action.
Example: As the user types "##someone" the add-in would recognize the pattern "\#\#\w{1}" and perform some action.
The problem is I have not found a way to inspect what the user is typing.
Is this restricted? If so, looks like the only option would be to hook into the Send() event and inspect the message then - less ideal.
I'd like to write this add-in in Visual Studio 2010 for Outlook 2010
Any ideas welcomed.
I believe what you're looking for is "Smart Tags". This should provide you a good overview and a direction to go: http://msdn.microsoft.com/en-us/library/vstudio/ms178786%28v=vs.100%29.aspx
Here's the SDK: http://msdn.microsoft.com/en-us/library/vstudio/aa169576.aspx
And a basic tutorial: http://www.add-in-express.com/docs/net-smart-tags.php
Hope this helps.
Have you tried to use MailItem.Body?
Also, Application.AcvtiveInspector.WordEditor will return an instance of the Word's Document object that you should be able to access and manipulate the text as the user types it.
I'm trying to catch all user text navigation events (selection changes) in the text editor to update a tool window (contextual to the current position).
The "LineChanged" event under TextEditorEvents only fires on updates, and I did not manage to find any other event.
Anyone knows of such?
Arielr
Should have looked there first:
http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/7db1fa83-41f3-4261-a68b-fc10a388f684/
Basically - there's no way to catch that event (and polling for the text changes was provided as an alternate option). Maybe 2010 will provide that API.