Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel data format problem (Urgent)
Hi,
I'm downloading grid data to excel document using following cod 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 o varchar type which contains numeric values (00002321,009860 ..).Th output result in the excel, this columns is appearing with all th 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, Aja -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel data format problem (Urgent)
I don't know if You can modify somehow the code You supplied (I don't really
understand it), but You may format the cells in Excel after fetching data. Range("SomeRangeHere").NumberFormat="00000000" or fetch the data as strings what will prevent Excel from deleting leading zeroes. "ajaykrishna" wrote in message ... 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") |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel problem trying to format columns of data | Excel Worksheet Functions | |||
Excel problem - urgent | Excel Discussion (Misc queries) | |||
*Hi- Urgent (but of course) I need a music cue sheet in excel format....(sample attached)......thanks for the help! - wsr-comp-cuesheet.pdf (0/1) | Excel Discussion (Misc queries) | |||
*Hi- Urgent (but of course) I need a music cue sheet in excel format....(sample attached)......thanks for the help! - wsr-comp-cuesheet.pdf (1/1) | Excel Discussion (Misc queries) | |||
Urgent Help Required on Excel Macro Problem | Excel Discussion (Misc queries) |