Home > Net >  Open the word card die error 80080005 servers running failure is how to return a responsibility
Open the word card die error 80080005 servers running failure is how to return a responsibility

Time:11-14

Code:
Using System;
using System.Collections.Generic;
Using System.Com ponentModel;
Using System. The Data;
Using System. Drawing;
Using System. Linq;
Using System. The Text;
Using System. The Threading. The Tasks;
Using System. Windows. Forms;
Using MSWord.=the Microsoft Office. Interop. Word;
The namespace WindowsFormsApplication1
{
Public partial class Form1: Form
{
Private MSWord. Application m_word;
Private MSWord. Document m_doc;
Public _click ()
{
InitializeComponent ();
M_word=new MSWord. Application ();

The Object filefullname="d: \ \ 16 _up doc";
The Object confirmConversions=Type. Missing;
The Object readOnly=Type. Missing;
The Object addToRecentFiles=Type. Missing;
The Object passwordDocument=Type. Missing;
The Object passwordTemplate=Type. Missing;
The Object revert=Type. Missing;
The Object writePasswordDocument=Type. Missing;
The Object writePasswordTemplate=Type. Missing;
The Object format=Type. Missing;
The Object encoding=Type. Missing;
The Object visible=Type. Missing;
The Object openConflictDocument=Type. Missing;
The Object openAndRepair=Type. Missing;
The Object documentDirection=Type. Missing;
The Object noEncodingDialog=Type. Missing;

For (int I=1; I & lt;=m_word. Documents. Count; I++)
{
String STR=m_word. Documents [I] FullName. The ToString ();
If (STR==filefullname. ToString ())
{
MessageBox. Show (" please do not repeat open the document ");
return;
}
}
Try
{
M_word. Documents. The Open (ref filefullname,
Ref confirmConversions, ref readOnly, ref addToRecentFiles,
Ref passwordDocument, ref passwordTemplate, ref revert,
Ref writePasswordDocument, ref writePasswordTemplate,
Ref ref format, encoding, ref visible, ref openConflictDocument,
Ref openAndRepair, ref documentDirection, ref noEncodingDialog
);
M_word. Visible=true;
}
The catch (System. Exception ex)
{
MessageBox. Show (" error opening Word document ");
}
}
}
}
Card to death after a period of time to
"System.Runtime.InteropServices.COM Exception" type of untreated abnormalities in mscorlib. DLL in

Other information: retrieve the COM class factory clsids for {000209 ff - 0000-0000 - C000-000000000046} component failure, the reason is that appear the following error: fail to run the 80080005 (exception from HRESULT: 0 x80080005 (CO_E_SERVER_EXEC_FAILURE)),



System is Windows 10, VS2015 office2013

CodePudding user response:

Installation is complete version of Microsoft Office? In VS back Office under the reference library
Not yet, refer to https://blog.csdn.net/siyusiying/article/details/52346673

CodePudding user response:

In the 2019 or not
  •  Tags:  
  • C#
  • Related