.net 导出word问题
HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(DateTime.Today.ToString("yyyyMMdd") + ".doc", System.Text.Encoding.UTF8));
Response.ContentType = "application/vnd.ms-word";//指定生成文件的类型
HttpContext.Current.Response.Charset = "";
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.Default;
//关闭控件的视图状态
Panel1.Page.EnableViewState = false;
//初始化HtmlWriter
System.IO.StringWriter tw = new System.IO.StringWriter();
tw.WriteLine("<center>HHHHHHHHH</center>");
System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
Panel1.RenderControl(hw);
//输出
//tw.WriteLine("HHHHHHHHH");
HttpContext.Current.Response.Write(tw.ToString());
HttpContext.Current.Response.End();Panel1 面板里有<asp:Image ID="Image1" runat="server" ImageUrl="~/img/T01_T.gif" />
图 导出后图片 没有导出 只是一个图的占位 我怎样把图导出 并显示????
HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(DateTime.Today.ToString("yyyyMMdd") + ".doc", System.Text.Encoding.UTF8));
Response.ContentType = "application/vnd.ms-word";//指定生成文件的类型
HttpContext.Current.Response.Charset = "";
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.Default;
//关闭控件的视图状态
Panel1.Page.EnableViewState = false;
//初始化HtmlWriter
System.IO.StringWriter tw = new System.IO.StringWriter();
tw.WriteLine("<center>HHHHHHHHH</center>");
System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
Panel1.RenderControl(hw);
//输出
//tw.WriteLine("HHHHHHHHH");
HttpContext.Current.Response.Write(tw.ToString());
HttpContext.Current.Response.End();Panel1 面板里有<asp:Image ID="Image1" runat="server" ImageUrl="~/img/T01_T.gif" />
图 导出后图片 没有导出 只是一个图的占位 我怎样把图导出 并显示????
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货