如何在asp.net里动态生成word页面并且直接显示在ie中?

roapzone 2004-07-27 02:42:39
word文档的内容是根据数据库动态生成的,
...全文
229 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
pgwron 2004-09-03
  • 打赏
  • 举报
回复
心情依然不好,没分也给你顶
lang11zi 2004-09-03
  • 打赏
  • 举报
回复
up
vzxq 2004-09-03
  • 打赏
  • 举报
回复
nod
savagewang1978 2004-09-03
  • 打赏
  • 举报
回复
pgwron 2004-09-03
  • 打赏
  • 举报
回复
心情依然不好,没分也给你顶
ckvip 2004-09-03
  • 打赏
  • 举报
回复
下面代码把datagrid生成了word文档,并在ie显示
//生成
HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=RoadRepair.doc");
Response.ContentType = "application/vnd.ms-word" ;//指定生成文件的类型
HttpContext.Current.Response.Charset = "";
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.Default;
System.IO.StringWriter tw=new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter hw=new System.Web.UI.HtmlTextWriter(tw)
DataGrid1.RenderControl(hw);//datagrid转成string
HttpContext.Current.Response.Write(hw.tosting());
HttpContext.Current.Response.End();

//显示
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType="application/msword";
Response.WriteFile("RoadRepair.doc");
Response.Flush();
Response.Close();
Edison621 2004-09-03
  • 打赏
  • 举报
回复
com
yingshis 2004-09-03
  • 打赏
  • 举报
回复
up
roapzone 2004-09-03
  • 打赏
  • 举报
回复
顶!!
roapzone 2004-07-28
  • 打赏
  • 举报
回复
没有人回答。希望MVP的人过来解决!·
给点思路,ole还是com??
tailer88 2004-07-27
  • 打赏
  • 举报
回复
顶一下~
这也是我想知道的问题~
希望高手进来回答一下~
fx718 2004-07-27
  • 打赏
  • 举报
回复
up
roapzone 2004-07-27
  • 打赏
  • 举报
回复
没有人回答

62,041

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧