首页 > 代码库 > C#打开word(通过程序集,组件的话会有版本问题)

C#打开word(通过程序集,组件的话会有版本问题)

OpenFileDialog P_GetFile = new OpenFileDialog(); //创建打开文件对话框对象
DialogResult P_dr = P_GetFile.ShowDialog(); //显示打开文件对话框
object oMissing = System.Reflection.Missing.Value;
if (P_dr == DialogResult.OK) //是否单击确定
{
wordApp = new MSWord.Application();
wordApp.Visible = true;
object obj = (object)(P_GetFile.FileName);
wordApp.Documents.Open(ref obj,ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
}

C#打开word(通过程序集,组件的话会有版本问题)