Skip to main content

Undo

Undoes the user's last action.

Syntax​

expression.Undo();

expression - A variable that represents an Api class.

Parameters​

This method doesn't have any parameters.

Returns​

This method doesn't return any data.

Example​

const addTextToDocument = function () {
const doc = Api.GetDocument();
const paragraph = doc.GetElement(0);
paragraph.AddText(Asc.scope.text);
};

Asc.scope.text = 'The text string that we first added to the document.';
Asc.plugin.callCommand(addTextToDocument);
Asc.plugin.executeMethod('Undo');

Asc.scope.text = 'And the second one, which is the only one that will remain visible after calling Undo method.';
Asc.plugin.callCommand(addTextToDocument);