Excel导出数据时:当是身份证的时候,导出的数据不准确。而且设置为文本格式也是无用的。
解决方法:
protected
void
gvPeoField_RowDataBound(
object
sender, GridViewRowEventArgs e)
... {
e.Row.Cells[3].Attributes.Add("style", "vnd.ms-excel.numberformat:@");
}
... {
e.Row.Cells[3].Attributes.Add("style", "vnd.ms-excel.numberformat:@");
}
绑定数据后,设置一下此列的格式。
详细请参考:http://dotnet.aspx.cc/ShowDetail.aspx?id=8A4CBF47-B888-4832-3389-ED3A3A3C8AAB