我想实现的功能是把HTML代码导出WORD,HTML里有图片,在WORD里也能显示图片,并且导出WORD的时候有页眉页脚。我以前用的代码只能导出文字,不能导出图片,也不会设置页眉页脚。附上以前的代码 string header = System.DateTime.Now.ToString("MMddHHmm");
System.Web.HttpContext curContext = System.Web.HttpContext.Current;
System.IO.StringWriter strWriter = null;
System.Web.UI.HtmlTextWriter htmlWriter = null;
curContext.Response.Charset = "GB2312";
curContext.Response.ContentType = "application/ms-word";
curContext.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
curContext.Response.AppendHeader("Content-Disposition", "attachment;filename=" + "" + HttpUtility.UrlEncode(header, System.Text.Encoding.UTF8).ToString() + ".doc");
strWriter = new System.IO.StringWriter();
htmlWriter = new System.Web.UI.HtmlTextWriter(strWriter);
tbodyShow1.RenderControl(htmlWriter);
curContext.Response.Write(strWriter.ToString());
curContext.Response.End();求各位帮帮小弟,项目需要。HTML,图片,页眉页脚,WORD
System.Web.HttpContext curContext = System.Web.HttpContext.Current;
System.IO.StringWriter strWriter = null;
System.Web.UI.HtmlTextWriter htmlWriter = null;
curContext.Response.Charset = "GB2312";
curContext.Response.ContentType = "application/ms-word";
curContext.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
curContext.Response.AppendHeader("Content-Disposition", "attachment;filename=" + "" + HttpUtility.UrlEncode(header, System.Text.Encoding.UTF8).ToString() + ".doc");
strWriter = new System.IO.StringWriter();
htmlWriter = new System.Web.UI.HtmlTextWriter(strWriter);
tbodyShow1.RenderControl(htmlWriter);
curContext.Response.Write(strWriter.ToString());
curContext.Response.End();求各位帮帮小弟,项目需要。HTML,图片,页眉页脚,WORD
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货