Microsoft.Office.Interop.Word timout [英] Microsoft.Office.Interop.Word timout

查看:165
本文介绍了Microsoft.Office.Interop.Word timout的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用Web服务器中的Microsoft.Office.Interop.Word(是的,我知道不建议这样做).

当我在机器上运行它时,它运行良好,但是在服务器上运行时,我在以下行上遇到了超时:
Documents.Open //尝试打开文件时.

有什么我想念的吗?有没有更好的方法可以在Web服务器/网站中编辑Word文档? (我无法使用字符串生成器创建新文件,也无法输出到文件;我需要编辑服务器上现有的文件.)

由于我已经坚持了几天,所以任何输入都会受到赞赏...

I have been using using Microsoft.Office.Interop.Word in my webserver (yes, i know it is not recommended).

When I ran it on my machine, it runs fine, but when running on the server I get a timeout on the following line:
Documents.Open //when trying to open the file.

Is there something I''m missing? Is there a better way to edit a Word document within web servers/websites? (I can''t create a new one using string builder or outputting into file; I need to edit an existing one that sits on the server.)

Any input will be appreciated as I''m stuck on this for few days already...

推荐答案

您可以在网页上使用 HtmlTextWriter 用于创建Word/Excel文档并发布编辑...

例如:将网页上的网格导出到Word
You can use HtmlTextWriter on webpage for create Word/Excel document and post edit...

For example: export Grid on webpage to Word
public static void ExportToWord(System.Web.UI.Page p, DataGrid grdGridView, string fileName)
{
  p.Response.Clear();
  p.Response.AddHeader("content-disposition", string.Format("attachment;filename={0}.doc", fileName));
  p.Response.Charset = "";
  p.Response.ContentType = "application/vnd.doc";
  StringWriter stringWrite = new StringWriter();
  HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
  myGridView.RenderControl(htmlWrite);
  p.Response.Write(stringWrite.ToString());
  p.Response.End();
}


您可以看一下:
http://blogs.msdn.com/b/microsoft_office_word/archive/2009/10/26/introducing-word-automation-services.aspx [ http://blogs.msdn.com/b/microsoft_office_word/archive/2009/09/09/co-authoring-in-word-2010.aspx [
You can take a look at:
http://blogs.msdn.com/b/microsoft_office_word/archive/2009/10/26/introducing-word-automation-services.aspx[^]
and
http://blogs.msdn.com/b/microsoft_office_word/archive/2009/09/09/co-authoring-in-word-2010.aspx[^]

Full authoring capabilities doesn''t come cheap, but if you do the math:
(hours required to implement solution) x (hourly rate)

You can probably justify buying a sharepoint server license ...

Regards
Espen Harlinn


这篇关于Microsoft.Office.Interop.Word timout的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆