代码如下:
//导出的报表添加表头
Dictionary<string, object> headDic = new Dictionary<string, object>();//保存要设置的表格标题
headDic.Add("topHead", "公益广告列表-黄金时间段");
headDic.Add("dateHead", "日期:" + beginTime.ToString("yyyy-MM-dd") + "——" + endTime.ToString("yyyy-MM-dd"));
<span style="color:#ff0000;"> string[] array = new string[0];
List<string> arrList = array.ToList();
for (int i = 0; i < tb.Columns.Count; i++)
{
arrList.Add(tb.Columns[i].ToString());
}
array = arrList.ToArray();
headDic.Add("title", array);</span>
导出页面
context.Session["ExportData"] = toExport;
context.Session["TableHead_Ad"] = headDic;