ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel data format problem (Urgent) (https://www.excelbanter.com/excel-programming/286485-excel-data-format-problem-urgent.html)

ajaykrishna[_2_]

Excel data format problem (Urgent)
 
Hi,

I'm downloading grid data to excel document using following code
snippet:

Response.Clear()
Response.Buffer = True
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("content-disposition",
"attachment;filename=CDSInfo.csv")
Response.Charset = ""
Me.EnableViewState = False
Dim oStringWriter As New System.IO.StringWriter()
Dim oHtmlTextWriter As New System.Web.UI.HtmlTextWriter(oStringWriter)
Grid1.RenderControl(oHtmlTextWriter)
Response.Write(oStringWriter.ToString())
Response.End()

I'm getting everything OK except one problem. I have one column of
varchar type which contains numeric values (00002321,009860 ..).The
output result in the excel, this columns is appearing with all the
leading zeros trimmed off i.e. 00002321 is displayed in excel as 2321.
What should I do to get the original value without any trim i.e.
00002321 ?

Thanks,
Ajay


---
Message posted from http://www.ExcelForum.com/



All times are GMT +1. The time now is 10:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com