Tracked Changes

Overview

Tracked changes are called revisions in the API. A Revision represents a revision (tracked change) in a document node or style, and the RevisionCollection from Document.getRevisions holds the ones in a document. This page shows how to accept all of them at once, which turns a reviewed document into its final version.


Prerequisites

RequirementDetail
Java8 or later
DependencyThe package from Installation
Importimport com.aspose.words.*;

Accept All Tracked Changes

Open the reviewed document, call acceptAllRevisions, and save the result under a new name.

import com.aspose.words.*;

Document doc = new Document("reviewed.docx");
doc.acceptAllRevisions();
doc.save("final.docx");

Tips and Best Practices

  • Save to a new file name, as the example does, so the reviewed original stays available.
  • Revision has accept and reject methods, and RevisionCollection has acceptAll and rejectAll. This guide shows Document.acceptAllRevisions.

Common Issues

IssueCauseFix
The compiler reports cannot find symbol for Document.The com.aspose.words package is not imported.Add import com.aspose.words.*;.
The compiler reports an unreported exception.The Document constructors, Document.save and some other methods declare throws Exception.Declare it on the calling method or catch it.

FAQ

What does acceptAllRevisions do?

It accepts all tracked changes in the document.

Where do I find the individual revisions?

Document.getRevisions gets a collection of revisions (tracked changes) that exist in the document.

Can I reject the changes instead?

RevisionCollection has a rejectAll method. This guide has no example for it.


API Reference Summary

Class / MethodDescription
Document.acceptAllRevisions()Accepts all tracked changes in the document.
Document.getRevisions()Gets a collection of revisions (tracked changes) that exist in this document.
RevisionRepresents a revision (tracked change) in a document node or style.
RevisionCollectionA collection of Revision objects that represent revisions in the document.

Related Guides

See Also