Represents a class that controls the handling of revisions.
The RevisionHandler class allows you to work with revisions in documents.
It provides methods to retrieve the list of revisions, apply changes to revisions, and save the modified document.
Example usage:
try (RevisionHandler revisionHandler = new RevisionHandler(sourceFile)) {
List revisionList = revisionHandler.getRevisions();
for (RevisionInfo revisionInfo : revisionList) {
if (revisionInfo.getType() == RevisionType.DELETION)
// Set an action to be applied to the revision
revisionInfo.setAction(RevisionAction.Accept);
}
// Create an instance of ApplyRevisionOptions
ApplyRevisionOptions revisionChanges = new ApplyRevisionOptions();
revisionChanges.setChanges(revisionList);
// Apply the revisions using the options
revisionHandler.applyRevisionChanges(resultFile, revisionChanges);
}
Initializes a new instance of the RevisionHandler class with a document.
Parameters:
Parameter
Type
Description
document
com.aspose.words.Document
The document.
SOURCE_PATH_IS_NULL
public static final String SOURCE_PATH_IS_NULL
getRevisions()
public List<RevisionInfo> getRevisions()
Gets the list of all revisions.
Due to the fact that revisions were originally sorted in a group, revisions must be taken from a List.
In the List, a single revision can be split into multiple revisions with the same general text.
Since the List may contain revisions with the same general text, this must be controlled when creating a list of revisions for the user.
This is controlled here using List<RevisionGroup> groups.
Returns:
java.util.List<com.groupdocs.comparison.words.revision.RevisionInfo> - the list of revisions.