导出excel无网格,css丢失,如何解决??
这是我导出excel的代码
Response.Clear();
Response.Buffer = true;
Response.Charset = "utf-8 ";
Response.AppendHeader( "Content-Disposition ", "attachment;filename=FileFlow.xls ");
Response.ContentEncoding = System.Text.Encoding.GetEncoding( "utf-8 ");
Response.ContentType = "application/ms-excel ";
this.EnableViewState = false;
System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
this.Table2.RenderControl(oHtmlTextWriter);
Response.Write(oStringWriter.ToString());
Response.End();
导出到excel就是一片东西,没有网格,该怎么解决????
------解决方案--------------------html和excel毕竟是2个东西,不是完全兼容的。你的html里设置
<table border=1> 导出去好像带边框的。css不是兼容的