Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Call a function every time a new comment is inserted/deleted inside a Word document, using Javascript API for Office Add-Ins

An Add-In that I'm creating needs to keep track of all the comments that currently exists in the document.

To do so, I'd like to refrain from having to constantly poll the Word application after a certain time for its data, or also refrain from having to use Office.EventType.DocumentSelectionChanged to call the function every time anything changes, because it would be too costly.

Is there any other way that I can know when a comment has been inserted/deleted inside a document?

like image 593
CodeIntern Avatar asked Oct 16 '25 06:10

CodeIntern


1 Answers

Neither the COM nor the JS APIs provide an event for this.

With the COM APIs it would be possible to "trap" the insertion by re-purposing the Ribbon controls using Ribbon XML. (VBA can even link into the internal command.) Unfortunately, access to built-in Ribbon controls is not provided by the JS API "commands".

So currently the only possibility besides the event you mention would be to provide your own tools and request the user work with those.

like image 101
Cindy Meister Avatar answered Oct 17 '25 20:10

Cindy Meister



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!