ASP.NET 中读取word文档关闭读取进程
这个下面是我读取Word文档的代码,现在问题是下面代码能够读取,但是在读取之后的进程依然开启,那位能够帮我解决这个问题。谢谢了。/// <summary>
/// 读取word文档
/// </summary>
/// <param name="path">文档路径</param>
/// <returns>返回内容</returns>
public static string ReadWord(string path)
{
string str = string.Empty;
Document myWordDoc;
object saveChange = string.Empty;
Microsoft.Office.Interop.Word.Application myWordApp = new Microsoft.Office.Interop.Word.ApplicationClass();
object filepath = HttpContext.Current.Server.MapPath(path);
object oMissing = Missing.Value;
myWordDoc = myWordApp.Documents.Open(ref filepath, 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);
str = myWordDoc.Content.Text;
//myWordApp.ActiveDocument.Close(ref oMissing, ref oMissing, ref oMissing);
return str;
} --------------------编程问答-------------------- 高手赶紧进来 回复一下!! --------------------编程问答-------------------- myWordDoc.Close(ref objMissing, ref objMissing, ref objMissing);
myWordDoc.Quit(ref objMissing, ref objMissing, ref objMissing); --------------------编程问答-------------------- 上面的错了,应该是
myWordApp.Close(ref objMissing, ref objMissing, ref objMissing);--------------------编程问答-------------------- myWordApp.Close(ref objMissing, ref objMissing, ref objMissing);
myWordApp.Quit(ref objMissing, ref objMissing, ref objMissing);
myWordApp.Quit(ref objMissing, ref objMissing, ref objMissing);
补充:.NET技术 , ASP.NET