.NET在webform中将word另存为html?
leader做了一个winform的项目 测试成功了 可是放到我的webform里却不行 这是什么原因?代码如下:
Word.ApplicationClass w_app = new Word.ApplicationClass();
Type wordType = w_app.GetType();
Word.Documents w_docs = w_app.Documents;
Type docsType = w_docs.GetType();
//object m_path = @"C:\\Inetpub\\wwwroot\\WebApplication1\\data\\";
object m_path = this.Server.MapPath("/WebApplication1/data/");
object filename = @"空履2";
object p_file_nm = m_path.ToString() + filename.ToString() + @".doc";
//object saveFileName = m_path + "HTML\\" + filename + @".html";
object saveFileName = m_path + "HTML/" + filename + @".html";
//Word.Document w_doc = (Word.Document)docsType.InvokeMember("Open",System.Reflection.BindingFlags.InvokeMethod,null,w_docs,new Object[] { p_file_nm, true, true });
Word.Document w_doc = (Word.Document)docsType.InvokeMember("Open",System.Reflection.BindingFlags.InvokeMethod,null,w_docs,new Object[] { p_file_nm, true, true });new UnknownWrapper(null)
Type docType = w_doc.GetType();
docType.InvokeMember("SaveAs", System.Reflection.BindingFlags.InvokeMethod,null,w_doc, new object[]{saveFileName, Word.WdSaveFormat.wdFormatFilteredHTML});
wordType.InvokeMember("Quit",
System.Reflection.BindingFlags.InvokeMethod,
null,
w_app,
null);