Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MS Word JavaScript API - event handler for Content Controls

Is there a way to fire a function when clicking on a contentControl in Office-js?

I am writing an add-on for MS Word, and I have inserted content controls, that will be associated with a list in my add-in. I need to fire a function when clicking on the content control, so I can scroll to the item in the list and highlight it.

I have found the "Document.ContentControlOnEnter event (Word)" which seems to be what I am looking for, but I cannot understand how to attach an event-listener that listens to this event.

I am writing the plugin in typescript react.

like image 260
Atonic Avatar asked Sep 13 '26 12:09

Atonic


1 Answers

Word web add-ins don't provide anything for that.

UPD: You may be interested in the onSelectionChanged event which is fired when selection within the content control is changed. Note, this event is provided as in preview and not availble in a production environment.

like image 192
Eugene Astafiev Avatar answered Sep 15 '26 06:09

Eugene Astafiev