向高手请教一个关于导出到Word的问题
我用下面这种方式将页面导出到Word时背景图片导不出来是怎么回事?
string fileName = string.Empty;
if (string.IsNullOrEmpty(fileName))
{
fileName = "著作工作量分配单";
}
System.IO.StringWriter sw = new System.IO.StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
this.Page.Form.RenderControl(htw);
string pageHtml = sw.ToString();
int startIndex = pageHtml.IndexOf("<div id=\"Print\"");
int endIndex = pageHtml.LastIndexOf("</div>");
int lenth = endIndex - startIndex;
pageHtml = pageHtml.Substring(startIndex, lenth);
pageHtml = pageHtml.Remove(pageHtml.LastIndexOf("<div>"));
HttpContext context = HttpContext.Current;
context.Response.AppendHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8) + ".doc");
context.Response.ContentType = "application/ms-word";
context.Response.ContentEncoding = System.Text.Encoding.UTF8;
context.Response.Charset = "UTF8";
context.Response.Write(pageHtml);
context.Response.End();
------解决方案--------------------
mark
------解决方案--------------------
顶