gridview打印
gridview打印出力面的数据包括分页当中未被显示出来的数据呢?
------解决方案--------------------重新取数据,将取出的数据配置成HTML字符串,然后导出
public static void GenerateByHtmlString(string Typename, string TempHtml)
{
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Buffer = true;
HttpContext.Current.Response.Charset = "utf-8 ";
string Filename = Typename + ".xls ";
HttpContext.Current.Response.AppendHeader( "Content-Disposition ", "online;filename= " + Filename);
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding( "utf-8 ");
HttpContext.Current.Response.ContentType = "application/ms-excel ";
//this.EnableViewState = false;
HttpContext.Current.Response.Write(TempHtml);
HttpContext.Current.Response.End();
}
Typename为导出的文件名,TempHtml为HTML字符串