【发布时间】:2012-02-16 08:43:06
【问题描述】:
我尝试用c#打开一个word文档。
当我打开文档后,页面被屏蔽了。
代码如下:
HttpContext.Current.Response.Write(temp);
//HttpContext.Current.Response.End();
//HttpContext.Current.Response.Flush();
//HttpContext.Current.Response.Write(sw.ToString());
//HttpContext.Current.Response.clear();
//HttpContext.Current.Response.End();
//HttpContext.Current.Response.SuppressContent = true;
//HttpContext.Current.Response.Close();
//Response.Redirect(Page.Request.Url.AbsolutePath.Substring(0, Page.Request.Url.AbsolutePath.LastIndexOf("/")) + "/PIEditor.aspx?PostID=" + Request.Params["PostID"], true);`
//HttpContext.Current.Response.End();
如您所见,我尝试了不同的选项,但没有结果,显示打开或保存文档的窗口,但我无法单击页面之后的任何按钮。它似乎已停用或停止。
【问题讨论】:
-
您粘贴的代码看起来像是在尝试将消息发送回网页,而不是打开 Word 文档。你想达到什么目的?
-
HttpContext.Current.Response.AddHeader("content-disposition", string.Format("attachment; filename={0}", "PIExport.xls")); HttpContext.Current.Response.ContentType = "应用程序/ms-excel";我尝试打开文档。它像我一样打开,但问题出现在页面停止后......谢谢。
-
你把我和 cmets 搞混了,他们是 cmets 还是你用他们?
-
我试过了,但没有结果
-
如您所见,它们现在已被评论