Hi,
I have a flow as described below:
- Generate a word doc using Aspose.Words plugin (lets call it docB).
- Modify the doc above (docB).
- Generate a new doc (similar to docB before the modifications) using Aspose.Words plugin (lets call it docA).
- Comapre those 2 docs using the code below:
Aspose.Words.License license = new Aspose.Words.License();
license.SetLicense("Aspose.Words.lic");
docA = new Aspose.Words.Document(newFilePath);
docB = new Aspose.Words.Document(editedFilePath);
if (docB.HasRevisions)
{
docB.AcceptAllRevisions();
}
docA.Compare(docB, "user", DateTime.Now);
for (var index = 0; index < docA.Revisions.Count; index++)
{
switch (docA.Revisions[index].RevisionType)
{
case RevisionType.FormatChange:
case RevisionType.StyleDefinitionChange:
docA.Revisions[index].Accept();
break;
case RevisionType.Insertion:
case RevisionType.Moving:
case RevisionType.Deletion:
break;
default:
break;
}
}
docA.Save(newFilePath);
- Save the compared doc as docA.
My expectation is that all “FormatChanges” revisions will be accepted and once the user open the new file (docA) he will see only insertion, deletion and moving changes, to be more precise, I want to show the user only merge conflicts in the final doc (exclude FormatChange and StyleDefinitionChange).
But the “docA.Revisions[index].Accept();” method is not working as expected.
When I open the result doc The FormatChange revisions are still there and not accepted.
In this example I’ve added this text “(הוספה
ידנית)” to docB and the revisions count is above 300.
Attached the relevant docs:
- docB.docx - the modified doc.
- docA.docx - the original doc.
- docA_After compare.docx - the comparison result doc.
Thanks,
Leon Shmulevich