简体   繁体   中英

Office-Js Word Add In: Detect user change in document/ how to use bindingdatachanged functionality

New Office-js user, I'm working on an advanced find and replaced plug in for efficiency purposes, has anyone had any luck detecting a change to a word document? What I'd ideally love is that whenever text is changed/edited, I could trigger my function. I've been looking into addHandlerAsync(Office.EventType.BindingDataChanged, onBindingDataChanged); , but can't seem to figure out the proper use case for this code to attach it to the word document. I also would need a way of caching the before and after state, which I've seen people mention but again haven't seen any code examples for it.

I'm very aware that this will probably cause issues with that frequent running, so equally if anyone had any experience debouncing/throttling events in office js, or delaying them to set intervals that would equally be awesome.

Many thanks in advance!

Office JavaScript API (OfficeJS) doesn't provide any event for handling document changes. You may vote for the existing request file few days ago, see Office.js Word Document content changes for more information.

You can post or vote for an existing feature request on Tech Community where they are considered when the Office dev team goes through the planning process.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM