/// <summary>
/// Repeater 导出E
/// </summary>
/// <param name="ctl"></param>
public void ReportToExcel(List<QJProblemTasks> results)
{
StringWriter sw = new StringWriter();
sw.WriteLine("城区\t道路名称\t道路类型\t问题时间\t问题类型\t详细地址");
foreach (var i in results)
{
DateTime issueDate = new DateTime();
if (i.IssueTime == null)
issueDate = i.CheckTime;
else
issueDate = i.IssueTime.Value;
sw.Write(i.DistrictName + "\t" + i.RoadName + "\t" + i.RoadTypeName + "\t" + issueDate.ToString() +
"\t" + i.RuleName + "\t" +
i.Address);
sw.WriteLine();
}
sw.Close();
Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode("我的问题", System.Text.Encoding.UTF8) + ".xls");
Response.ContentType = "application/ms-excel";
Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
Response.Write(sw);
Response.End();
}