protected void ExportToExcel(object sender, EventArgs e)
{
Response.ClearContent();
Response.AddHeader("content-disposition", "attachment;filename=Detail.xls");
Response.ContentType = "application/excel";
StringWriter sw = new StringWriter();
HtmlTextWriter htm = new HtmlTextWriter(sw);
Repeater repAllUsers = this.rptrRegistrationReport;
repAllUsers.DataSource = objAdmin.Getregdetails(start, enddate, usrtype);
repAllUsers.DataBind();
repAllUsers.RenderControl(htm);
Response.Write("<Table border='1'" + "cellSpacing='0' cellPadding='0' " +"style='font-size:12.0pt; '>");
Response.Write(sw.ToString());
Response.End();
}
所有数据都是正确导出的,但只有日期列显示#####。如何在Excel文件中显示日期。