These features are handy to use when several actions are performed in either Word or PowerPoint. Notice that it does not work in Excel. We are able to combine actions into one item in the undo stack, to clear the undo stack and to prompt the user when saving.
Makes your module undo-able with a single
It is possible to group all actions in the undo stack in a single item in the undo list in Word. To make such collection, use the following command when performing several commands in one single action:
<Cmd case="BaseExtensions:start-undo-record" name="x"/>
This command works in both Word and PowerPoint and must be used as the first one in a button. Define the name of the undo record, which is the collection of actions under one item-name, in the parameter
name. For instance, if the button contains several commands that format a shape, the name could be
"Shape Formatting". The name will only be used in Word. No matter what is defined, the name will not be used in PowerPoint as it will make the name of the collection by itself.
Finish the command chain with the command below. This will end the undo record.
Clear undo stack
We are able to clear the undo stack, where the entire list of all actions performed will be cleaned in both Word and PowerPoint. This works flawlessly in Word. In PowerPoint, we replace the current undo stack with maximum amount of new blank and empty entries. This prevents the user to see what operations that have been done as well as to undo the things that we have applied.
Use the following command to define whether the document should prompt user in terms of saving:
<Cmd case="BaseExtensions:set-saved" state="x"/>
state parameter to be
true if the command should tell the application that no actions have been made since last save. Thereby, it will not prompt the user for saving. If
false, the command will tell that actions have been made and thus prompt for saving.
Note that this does not actually save the document.