我们只需要在导出前,做如下处理,或者在该列加上以下代码中的样式就可以了。
foreach(DataGridItem dg in this.DataGrid1.Items)
{
dg.Cells[列].Attributes.Add("style", "vnd.ms-excel.numberformat: @;");
}
this.DataGrid1.RenderControl(hw);
我们只需要在导出前,做如下处理,或者在该列加上以下代码中的样式就可以了。
foreach(DataGridItem dg in this.DataGrid1.Items)
{
dg.Cells[列].Attributes.Add("style", "vnd.ms-excel.numberformat: @;");
}
this.DataGrid1.RenderControl(hw);