我想将gridview导出为excel。一列包含数值,如:
12345678998765432112345678899
但是当我导出到excel时,它显示为:
1234 + E11
我不想这样,我想要全部价值。
我使用了以下代码
Response.Clear();
Response.Buffer = true;
Response.AddHeader("content-disposition", "attachment;filename=ReportOutput.xls");
Response.Charset = "";
Response.ContentType = "application/vnd.ms-excel";
System.IO.StringWriter tw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
hw.WriteLine("<h3>Output Form</h3>");
GridView1.RenderControl(hw);
string style = "<style> .textmode { mso-number-format:\\@; } </style>";
Response.Write(style);
Response.Output.Write(tw.ToString());
Response.Flush();
Response.End();
仍然没有用。