日期:2014-05-17  浏览次数:20426 次

asp.net 在服务器端打开WORD文档(在服务端显示,不是在客户端)问题



  需求是客户在页面操作后,在服务器端打开一个WORD文档并显示.(!!!不是在客户机端打开,是在服务器上打开).

  问题是: 操作后,服务器上只能看到winword.exe这个进程,但服务器的显示器上根本没有显示.达人救命啊

  _word = new Microsoft.Office.Interop.Word.ApplicationClass();

  _word_file = _path;

  Word.Documents dd = null;

  dd = _word.Documents;

  _word_doc = dd.Open(ref _word_file, ref _missing, ref _missing, ref _missing);


  if (_isReadingLayout)
  {

  _word_doc.ActiveWindow.View.ReadingLayout = true;

  _word_doc.ActiveWindow.View.ReadingLayoutAllowMultiplePages = false;

  }

  _word.Visible = true;


 

------解决方案--------------------
帮顶一下

上次也碰到一个类似的问题:WinService程序,新建一个Execl文档并按特定格式写入数据;不过不稳定,操作完成后没办法关闭对应的进程,累计下来,一个进程被打开几十次...