天天看點

GridView導出Excel出現科學計數的解決辦法

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)

{

        if (e.Row.RowType == DataControlRowType.DataRow)

        {

          //解決身份證号超過15位導出Excel時出現科學計數法的問題

            e.Row.Cells[15].Attributes.Add("style", "vnd.ms-excel.numberformat:@"); 

        }

}