Я занимаюсь разработкой Office Development с помощью Visual Studio. И получите ошибку ниже
Error:
**
Unable to cast COM object of type 'Microsoft.Office.Interop.Word.ApplicationClass' to interface type 'Microsoft.Office.Interop.Word._Application'.
This operation failed because the QueryInterface call on the COM component for the interface with IID '{00020970-0000-0000-C000-000000000046}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
**
Код: (также на https://gist.github.com/1056809)
if (File.Exists((string)strDocPath))
{
Word.Application wdApp = new Word.Application();
wdApp.Visible = true; //Error thrown here
object readOnly = false;
object isVisible = true;
object oMissing = System.Reflection.Missing.Value;
//Open the word document
//Error thrown on line below.
Word.Document aDoc = wdApp.Documents.Open(ref strDocPath, ref oMissing, ref readOnly, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref isVisible,
ref oMissing, ref oMissing, ref oMissing, ref oMissing);
// Activate the document
aDoc.Activate();
}
Что это за ошибка? Как я могу избежать этого?