Using system; using system. windows. forms; using system. diagnostics; using Microsoft. office. interOP. word; namespace windowsformsapplication1 {public partial class form1: FORM {public form1 () {initializecomponent ();} private void button1_click (Object sender, eventargs E) {// determine whether the system contains word before loading. EXE process. If it contains, killprocess (); MessageBox. show (comparewordfile (@ "C: \ 1.doc", @" C: \ 2.doc "). tostring () );} Public bool comparewordfile (string source, string target) {object filename = source; var targetfilename = target; object missing = system. reflection. missing. value; object readonlyobj = false; var APP = new applicationclass {visible = false}; var Doc = app. documents. open (ref filename, ref missing, ref readonlyobj, ref missing, ref missing, Ref missing, ref missing, ref missing); Doc. trackrevisions = true; Doc. showrevisions = true; Doc. printrevisions = true; object comparetarget = wdcomparetarget. wdcomparetargetnew; Doc. compare (targetfilename, ref missing, ref comparetarget, ref missing); var changecount = app. activedocument. revisions. count; object savechanges = wdsaveoptions. wddon Otsavechanges; Doc. close (ref savechanges, ref missing, ref missing); app. quit (ref savechanges, ref missing, ref missing); Return changecount = 0;} public void killprocess () {const string processname = "winword"; var process = process. getprocessesbyname (processname); try {foreach (var p in process) {P. kill () ;}} catch (exception) {MessageBox. show ("Disable winword in the system first. EXE process! "," File comparison failed ", messageboxbuttons. OK); Return ;}}}}