1

I apologize if this is something simple, but I'm missing it. I'm using C# to build an add-in for Word. If a user selects some text and clicks a button, we are storing the selected Range to tag it for searching. I have a panel to display what uses have tagged. If a user updates some text in the middle of that range, I would like to have the display updated in real time.

I'm pretty sure I could listen for a key up event and update the display check if the user is currently in the middle of a tagged range. But, that seems like more effort than it should be. In an ideal word, the Range would fire a change event and I would be able to tap into it. Does anyone know if something like this exists?

Deduplicator
  • 44,692
  • 7
  • 66
  • 118
stevepra
  • 109
  • 2
  • 7
  • do you have anything existing currently that you are working on code wise..? I am sure there is something like capturing `highlighted text` do a google search and see what results come up.. have you tried that..? – MethodMan Dec 03 '15 at 19:34
  • I think I just found the answer to the question. It seems that Word doesn't send any kind of events when they are changed. I think I'll try something like what is suggested here- http://stackoverflow.com/questions/32770647/detecting-text-changes-in-word-2016-from-vsto-add-in – stevepra Dec 03 '15 at 20:28

1 Answers1

0

Word does not support change events for the document contents. Hooking into keyboard and mouse events is as close as you can get. You can find an example how to do that here:

Detecting text changes in Word 2016 from VSTO add-in

Dirk Vollmar
  • 172,527
  • 53
  • 255
  • 316