public static void DataTable2Excel(System.Data.DataTable dtData)
{
System.Web.HttpContext curContext = System.Web.HttpContext.Current;
System.Web.UI.WebControls.GridView dgExport = null;
System.IO.StringWriter strWriter = null;
System.Web.UI.HtmlTextWriter htmlWriter = null;
if (dtData != null)
{
curContext.Response.Clear();
curContext.Response.BufferOutput = true;
//设定输出的字符集
curContext.Response.Charset = "GB2312";
//假定导出的文件名为tiaoma.xls
curContext.Response.AppendHeader("Content-Disposition", "attachment;filename= Export.xls");
curContext.Response.ContentEncoding = System.Text.Enco
{
System.Web.HttpContext curContext = System.Web.HttpContext.Current;
System.Web.UI.WebControls.GridView dgExport = null;
System.IO.StringWriter strWriter = null;
System.Web.UI.HtmlTextWriter htmlWriter = null;
if (dtData != null)
{
curContext.Response.Clear();
curContext.Response.BufferOutput = true;
//设定输出的字符集
curContext.Response.Charset = "GB2312";
//假定导出的文件名为tiaoma.xls
curContext.Response.AppendHeader("Content-Disposition", "attachment;filename= Export.xls");
curContext.Response.ContentEncoding = System.Text.Enco