Free Support Forum -

Tracking changes in document


I’m reading about tracking changes in a Word documents using Aspose.Words.

For runs and paragraphs, I’m able to get the information if they’re part of a revision, but only if they’re part of INSERT revision (run.isInsertRevision()) or DELETE revision (run.isDeleteRevision()). How can I check if they’re part of MOVING revision? And how can I determine if it’s MOVE_FROM or MOVE_TO?



Thanks for your inquiry. Please use Revision.RevisionType property to get the type of this revision. The RevisionType.Moving shows content is moved in the document. Please iterate through the revisions of document and get their parent nodes using Revision.ParentNode. Hope this helps you.

Please ZIP and attach your input document and expected output. We will then provide you more information on this.

Hi Tahir,

Thanks for the information. Please find the input document attached. (9.8 KB)

I’m trying to iterate over all runs in a document and determine if they’re part of a revision. It works as expected using run.isInsertRevision() and run.isDeleteRevision(). When it comes to moving revision, there is no such method as the former mentioned.

There might be a workaround:

private Revision isMovingRevision(Document document, Run run) {

RevisionCollection revisions = document.getRevisions();

for (Revision revision : revisions) {
    if (revision.getParentNode() == run && revision.getRevisionType() == RevisionType.MOVING) {
	return revision;

return null;

but this would mean I must iterate over all revisions for every run I visit in a document (which does not belong to insertion or deletion revision). Also, what’s more important is that I can’t determine if the run is part of a revision which is moved to the current position or moved from the current position to some other position in a document.

In the attached document, you will find 4 paragraphs which I use to test different types of revisions. The first one contains deletion revision (strikethrough content). The second one has content which is moved from the fourth paragraph and is considered as moved to revision (double underlined content). The third one contains inserted revision (underlined content). The fourth one has content which is moved to the second paragraph and is considered as moved from revision (double strikethrough content).

Here’s the code:

public void testTrackChanges() throws Exception {

Document document = new Document("TrackChangesTest.docx");

System.out.println("Printing document runs:");

List<Run> runs = getDocumentRuns(document);

for (Run run : runs) {
    if (run.isInsertRevision()) {
	System.out.println("(Insert revision): " + run.getText());
    } else if (run.isDeleteRevision()) {
	System.out.println("(Delete revision): " + run.getText());
	// } else if (run.isMoveToRevision()) {
	// System.out.println("(MoveTo revision): " + run.getText());
	// } else if (run.isMoveFromRevision()) {
	// System.out.println("(MoveFrom revision): " + run.getText());
    } else if (isMovingRevision(document, run) != null) {
	System.out.println("(Moving revision): " + run.getText());
    } else {
	System.out.println("(Regular run): " + run.getText());

If you can provide something similar to the commented out code above, it would do a great job.

Please let me know if you need any clarifications.



Thanks for sharing the detail. Unfortunately, Aspose.Words does not support the requested feature at the moment. However, we have logged this feature request as WORDSNET-16452 in our issue tracking system. You will be notified via this forum thread once this feature is available.

We apologize for your inconvenience.


Regarding move from and move to revisions… If you open previously attached file in the DocumentExplorer, you can notice runs which are part of moving revisions between MoveToRangeStart, MoveToRangeEnd, MoveFromRangeStart and MoveFromRangeEnd nodes. Is there a way to visit these nodes via DocumentVisitor? Can I use these nodes as markers for moving revisions? (19.8 KB)



Thanks for your inquiry.

Unfortunately, DocumentVisitor does not visit these nodes. However, you can workaround your issue using following code example. Hope this helps you.

Document doc = new Document(MyDir + "TrackChanges.docx");
for (Node  node : (Iterable<Node>) doc.getChildNodes(NodeType.MOVE_FROM_RANGE_START, true))
    Node currentNode = node.nextPreOrder(doc);
    String text = "";
    while (currentNode.getNodeType() != NodeType.MOVE_FROM_RANGE_END)

        if(currentNode.getNodeType() == NodeType.RUN)
            text = currentNode.getText();
        currentNode = currentNode.nextPreOrder(doc);


Hi Tahir,

Thanks for the suggestion but I can’t use it since my application relies on the DocumentVisitor. I expect the feature you logged under WORDSNET-16452 will work for me. What’s the status of this ticket?



Thanks for your inquiry. We try our best to deal with every customer request in a timely fashion, we unfortunately cannot guarantee a delivery date to every customer issue. We work on issues on a first come, first served basis. We feel this is the fairest and most appropriate way to satisfy the needs of the majority of our customers.

Currently, this feature is pending for analysis and is in the queue. Once we complete the analysis, we will then be able to provide you an estimate.

You reported this issue in free support forum and it will be treated with normal priority. To speed up the progress of issue’s resolution, we suggest you please check our paid support policies from following link.
Paid Support Policies

The issues you have found earlier (filed as WORDSNET-16452) have been fixed in this Aspose.Words for .NET 18.6 update and this Aspose.Words for Java 18.6 update.