I have a Word add-in that needs to do some manipulation on the document and be able to undo them with one click on the undo button. In the VSTO add-in version, I am using the UndoRecord class, but it looks like there are no analogues in office-js.
I have a Word add-in that needs to do some manipulation on the document and be able to undo them with one click on the undo button. In the VSTO add-in version, I am using the UndoRecord class, but it looks like there are no analogues in office-js.
@lindalu-MSFT
This would be a great extension
@asokolov Thanks for posting. Can you explain more about this requirement? Are you saying that you want to undo and rollback to a specific document history?
Thanks.
Hello Yun,
maybe I can jump in here. We also use the UndoRecord class in our VSTO Add-In - quite a lot actually. There are two main things we achived with that:
That's what we did with it, does this help you?
Ernst
Hi, @Yun_Wang. Thanks for the answer!
In my case, I need an API that will allow me to put multiple commands in a batch, and if the user decides to undo the action they took, all the commands in the batch will be undone (by pressing Ctrl+z or Undo just once).
My specific use case: I have an add-in that does some rendering on a document (by changing a few content controls) and after rendering is complete, it also updates some document props. I can't do it within a single context.sync call and sometimes even within a single Word.run call due to business logic.
And once that is complete, the user will only be able to undo it by pressing Word's undo button (or Ctrl+z) multiple times. So I want to fix this so that the user can do the undo operation once.
In VSTO version I'm using the UndoRecord class to achieve this. So I'm looking for something similar in the OfficeJS API.
Regards,
Alex.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.