日期:2014-05-18  浏览次数:20411 次

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不行