如何将WEB页面中的数据保存为一个word文件

如何将WEB页面中的数据保存为一个word文件

protected void ConvertToHtml(string SrcFilePath,string TargetFilePath)
{
  Word.Application app=new Word.Application();
  app.Visible=false;
  Object o=Missing.Value;
  object docFile=SrcFilePath;
  _Document doc=app.Documents.Open(ref docFile,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);
  object fileName=TargetFilePath;
  object format=Word.WdSaveFormat.wdFormatDocument; //word format
  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);
  object t=true;
  app.Quit(ref t,ref o,ref o);
}

posted on 2004-10-14 16:22  LEE  阅读(558)  评论(0编辑  收藏  举报

导航