在asp.net中导出到excel时的日期问题

时间:2016-05-18 07:11:19

标签: c# asp.net excel

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文件中显示日期。

0 个答案:

没有答案