Click here to Skip to main content
15,939,960 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have i need to comparing two documents.In first document consider as original document and second document consider as our typed document and compare first and second documents.The different text in second document text will be highlighted with color. I am not getting any idea about this can anyone suggest me how to do this comparison in asp.net web applications. please can anyone help me out...

What I have tried:

Microsoft.Office.Interop.Word.Application wordApp = new Microsoft.Office.Interop.Word.Application();
wordApp.Visible = false;
wordApp.DisplayAlerts = WdAlertLevel.wdAlertsNone;
object wordTrue = (object)true;
object wordFalse = (object)false;
object fileToOpen = @"C:\Docs\2513902_DISP.doc";
//object fileToOpen = @"~\CompareDocuments\" + DateTime.Now.ToString("dd-MMM-yyyy") + fldUpload1.FileName;
object missing = Type.Missing;
Microsoft.Office.Interop.Word.Document doc1 = wordApp.Documents.Open(ref fileToOpen,
ref missing, ref wordFalse, ref wordFalse, ref missing,
ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref wordTrue, ref missing,
ref missing, ref missing, ref missing);

object fileToOpen1 = @"C:\Docs\2513902_PQA.doc";
Microsoft.Office.Interop.Word.Document doc2 = wordApp.Documents.Open(ref fileToOpen1,
ref missing, ref wordFalse, ref wordFalse, ref missing,
ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing);

Microsoft.Office.Interop.Word.Document doc = wordApp.CompareDocuments(doc1, doc2, WdCompareDestination.wdCompareDestinationRevised, WdGranularity.wdGranularityWordLevel,
true, true, true, true, true, true, true, true, true, true, "", false);
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900