Hi All ,
I have issue on Excel Export. While I do have String Coulmn in database but which contains Number. While I export.its how some other formats.
8.00318E+12
How can I resolve this issue? I can show the code too. If anyone knows just suggest me with example.
The following code i just used in Excel Export ..
-
- GridView GridView1 = new GridView();
- GridView1.ShowFooter = true;
- GridView1.AllowPaging = false;
- GridView1.DataSource = Dt2;
- GridView1.DataBind();
- Response.Clear();
- Response.Buffer = true;
- Response.AddHeader("content-disposition",
- "attachment;filename=MemberHistory.xls");
- Response.Charset = "";
- Response.ContentType = "application/vnd.ms-excel";
- StringWriter sw = new StringWriter();
- HtmlTextWriter hw = new HtmlTextWriter(sw);
- for (int i = 0; i < GridView1.Rows.Count; i++)
- {
-
- GridView1.Rows[i].Attributes.Add("class", "textmode");
- }
- GridView1.RenderControl(hw);
-
- string style = @"<style> textmode { mso-number-format:General } </style>";
- Response.Write(style);
- Response.Output.Write(sw.ToString());
- Response.Flush();
- Response.End();
Thanks in Advance
Karthik K