62,046
社区成员
发帖
与我相关
我的任务
分享
public static void ConvertToHtml(string docPath, string htmlPath)
{
Word.Application app = new Word.Application();
app.Visible = false;
object o = Type.Missing;
object docFile = docPath;
object readOnly = true;
object fileName = htmlPath;
/*office 2003 begin
Word.Document doc = app.Documents.Open(ref docFile, ref o,ref readOnly, ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref o);
object format = Word.WdSaveFormat.wdFormatFilteredHTML;
doc.SaveAs(ref fileName, ref format, ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref o,ref o);
//office 2003 end*/
//* offic 2000 begin
Word.Document doc = app.Documents.Open(ref docFile, ref o,ref readOnly, ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref o);
object format = Word.WdSaveFormat.wdFormatHTML;
doc.SaveAs(ref fileName, ref format, ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref o);
//*/
doc.Close(ref o,ref o,ref o);
object t = true;
app.Quit(ref t, ref o, ref o);
}