Hi Minh,
Thanks for your inquiry. To compare two word files, we suggest you to use the Document.Compare method. It compares one document with another document producing changes as number of edit and format revisions Revision( tracked change in a document node or style). Please Use latest version of Aspose.Words for .NET and try following code. Hope this helps you.
Document doc1 = new Document(MyDir + @"Original+Doc.docx");
Document doc2 = new Document(MyDir + @"Formatted+Doc.docx");
doc2.Compare(doc1, "ah", DateTime.Now);
NodeCollection runs = doc2.GetChildNodes(NodeType.Run, true);
foreach (Run run in runs)
{
if (run.IsFormatRevision)
{
Aspose.Words.Font font = run.Font;
bool isBold = font.Bold;
Console.WriteLine(run.Text + " --> " + isBold);
}
}
For more information, please visit How to Compare Two Word Documents. If you still face problem, please create stand-alone application (source code without compilation errors) that helps us reproduce your problem on our end and attach it here for testing. We will then provide you more information on this.
I have already use this in my code. After comparing, I have already have all Revisions which lets me know the doc include RevisionType Format change. However, we can’t get which format is applied to the revision including Bold, Italic, Underline, Strikethrough
Hi Minh,
Thanks for your inquiry. Please use latest version of Aspose.Words for .NET and try following code. Hope this helps you.
foreach (Revision rev in doc2.Revisions)
{
if (rev.ParentNode.NodeType.Equals(NodeType.Run))
{
Run run = rev.ParentNode as Run;
Console.WriteLine("run.Font.Bold --> " + run.Font.Bold);
Console.WriteLine("Font.Italic --> " + run.Font.Italic);
Console.WriteLine("Font.Bold --> " + run.Font.Bold);
Console.WriteLine("Font.Underline --> " + run.Font.Underline);
Console.WriteLine("Font.StrikeThrough --> " + run.Font.StrikeThrough);
}
}
If you still face any problem, please let us know we will try to help you as much we can. Thanks.
Hi Minh,
Thanks for sharing the detail. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-14681. You will be notified via this forum thread once this issue is resolved.
We apologize for your inconvenience.