0
我想比較c#中的2個單詞文檔,並在word文檔(.doc或.docx)中獲取不同的文本或句子作爲報告,報告可以突出顯示並排的差異,並正在使用下面的代碼如何比較C#中的2個單詞文檔與Ms-office安裝版本
Application wordApp = new Application();
wordApp.Visible = true;
object wordTrue = (object)true;
object wordFalse = (object)false;
object fileToOpen = @"D:\MyWorks\test1.doc";
object missing = Type.Missing;
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 = @"D:\MyWorks\test2.doc";
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);
Document doc = wordApp.CompareDocuments(doc1, doc2, WdCompareDestination.wdCompareDestinationNew, WdGranularity.wdGranularityWordLevel,
true, true, true, true, true, true, true, true, true, true, "", true);
上面的代碼中給予follwing錯誤
Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
請幫我在這方面,我想在系統不運行這個不包含ms-office安裝版本提供一些gudilines
感謝
SREE
感謝Christian爲您重播 – user1614315