How to format exponent to number from Export to excel?

Reedoutsoum

New Member
I am exporting data table to excel and one column is having Phone number in the data table but after export in Excel the phone number coloumn is displaying as exponent.I need as number, How to fix this ?\[code\] string fileName = "File" + DateTime.Now.ToString("MMddyyyy_HHmmss") + ".xls"; Response.AddHeader("content-disposition", "attachment;filename=" + fileName); //Response.AddHeader("content-disposition", "attachment;filename=File.xls"); Response.ContentType = "application/vnd.ms-excel"; StringWriter stringWriter = new StringWriter(); HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWriter); DataGrid dataExportExcel = new DataGrid(); dataExportExcel.ItemDataBound += new DataGridItemEventHandler(dataExportExcel_ItemDataBound); dataExportExcel.DataSource = dt; dataExportExcel.DataBind(); dataExportExcel.RenderControl(htmlWrite); System.Text.StringBuilder sbResponseString = new System.Text.StringBuilder(); sbResponseString.Append("<html xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:x=\"urn:schemas-microsoft-com:office:xlExcel8\" xmlns=\"http://www.w3.org/TR/REC-html40\"> <head></head> <body>"); sbResponseString.Append(stringWriter + "</body></html>"); Response.Write(sbResponseString.ToString()); Response.End();\[/code\]
 
Back
Top