当前位置: 代码迷 >> ASP.NET >> GridView导入Excel数据列中以0开头的数据0丢失,该如何解决
  详细解决方案

GridView导入Excel数据列中以0开头的数据0丢失,该如何解决

热度:6398   发布时间:2013-02-25 00:00:00.0
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不行
  相关解决方案