Word.ApplicationClass word = new ApplicationClass();
Type wordType = word.GetType();
Word.Documents docs = word.Documents;
Type docsType = docs.GetType();
object fileName = ff.Value;
Word.Document doc = (Word.Document)docsType.InvokeMember("Open", System.Reflection.BindingFlags.InvokeMethod, null, docs, new Object[] { fileName, true, true });
Type docType = doc.GetType();
object saveFileName = "C:/Documents and Settings/" + Path.GetFileNameWithoutExtension(ff.Value) + ".html";
string str = Path.GetFileNameWithoutExtension(ff.Value) + ".html";
docType.InvokeMember("SaveAs", System.Reflection.BindingFlags.InvokeMethod, null, doc, new object[] { saveFileName, Word.WdSaveFormat.wdFormatHTML });
//wordType.InvokeMember("Quit", System.Reflection.BindingFlags.InvokeMethod, null, word, null);
Response.Redirect(str);
其中ff是上传控件id,如把wdFormatHTML改成wdFormatXML则可转换成xml