读书人

GridView导入Excel数据列中以0开头的数

发布时间: 2012-04-22 18:34:46 作者: rapoo

GridView导入Excel数据列中以0开头的数据0丢失
在网上搜了解决办法
我也用了string style = @"<style>.text{mso-number-format:\@;}</script>";
Response.Write(style);
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Cells[0].Attributes.Add("class", "text");
}
}
但是仍然不起作用 请教大家是方法有错误或者还有其他解决办法吗?

[解决办法]
excel中的格式不正确导致的。
[解决办法]
e.Row.Cells[0].Attributes.Add("style", "vnd.ms-excel.numberformat:@");
加class不行
[解决办法]

探讨

e.Row.Cells[0].Attributes.Add("style", "vnd.ms-excel.numberformat:@");
加class不行

读书人网 >asp.net

热点推荐