• Possible to not accept all changes in a document before sending it back to aspose before comparing again for track changes? WIll it track 2nd, 3rd, etc. versions with different colors. Or are is there a better/ different approach we should use vs. merge and compare?
Summary
Aspose.Words for .NET can only compare two documents when both are free of existing tracked changes. If a document still contains revisions, the Document.Compare method throws an exception. The SDK currently has no built‑in way to keep the original revisions while adding a new set of comparison revisions.
Why it happens
Document.Comparevalidates that the input documents contain no revisions; this is the intended behavior.- A feature request (WORDSNET‑16956) to retain existing track‑changes together with newly created ones is logged but not yet implemented, and there is no documented workaround.
- Revision colors are not automatically changed for successive comparison runs; you would need to set author or color manually if you want visual distinction.
What to do next
- Clear existing revisions before comparing
// Load the documents
var original = new Aspose.Words.Document("Original.docx");
var revised = new Aspose.Words.Document("Revised.docx");
// Remove any tracked changes
original.AcceptAllRevisions(); // or original.RejectAllRevisions();
revised.AcceptAllRevisions(); // same for the second document
// Perform the comparison
original.Compare(revised, "Comparer", Aspose.Words.ComparisonType.New);
original.Save("ComparisonResult.docx");
The resulting file will contain only the new revisions produced by the comparison.
- Preserve the original revision history separately (if needed)
- Keep an unchanged copy of the original document (e.g.,
Original_WithRevisions.docx). - Work on a clean copy, accept all revisions, run the comparison as shown above, and distribute the comparison result.
- Users can view the historic changes by opening the original file alongside the comparison file.
- Manually differentiate successive version sets (optional)
var doc = new Aspose.Words.Document("CleanCopy.docx");
doc.RevisionsAuthor = "Version 2"; // set author name
doc.RevisionsColor = System.Drawing.Color.Blue; // optional visual cue
var builder = new Aspose.Words.DocumentBuilder(doc);
builder.Writeln("New content for version 2");
doc.Save("Version2.docx");
Setting RevisionsAuthor (and optionally RevisionsColor) before making edits lets you identify each revision set by author name or color.
- Alternative workflow – merge then edit
- Accept all revisions in both documents.
- Combine them using
Document.AppendDocumentorDocumentBuilder.InsertDocument. - Edit the merged document; the edits will be tracked as a single revision set.
This approach does not retain the original revision history but can be useful when a combined view of changes is sufficient.
If retaining the original tracked changes within the same file is a strict business requirement, the practical approach is to keep the original document unchanged and provide the comparison result as a separate file.
Note: The behavior described above is based on the current Aspose.Words for .NET implementation as documented in the support forum. Verify with your specific SDK version and review release notes for any updates.
I could not fully verify this explanation against the retrieved sources. Please double-check the behaviour in your environment and confirm the exact SDK/version.
Do you have the same limitation for JAVA version?
@scottarmstrong
You are asking about combine revisions feature, like MS Word does Review Tab > Compare > Combine? I am afraid it is not yet available in Aspose.Words. This feature request is logged as WORDSNET-16956 and is not yet scheduled for development.