我尝试用c#打开一个word文档。
当我打开文档时,页面被阻止。asp.net打开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文档。你想达到什么目的? – Jeggs 2012-02-16 08:45:49
HttpContext.Current.Response.AddHeader(“content-disposition”,string.Format(“attachment; filename = {0}”,“PIExport.xls”)); HttpContext.Current.Response.ContentType =“application/ms-excel”; 我尝试打开文档。其打开像我这样但页面停止后问题来了.. 谢谢。 – user1213375 2012-02-16 08:47:40
你把我的评论混淆了,他们是评论还是你用它们? – Aristos 2012-02-16 08:54:31