HighTechTalks DotNet Forums  

Excel data format problem (Urgent)

Dotnet Academic General Discussions microsoft.public.dotnet.academic


Discuss Excel data format problem (Urgent) in the Dotnet Academic General Discussions forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
ajaykrishna
 
Posts: n/a

Default Excel data format problem (Urgent) - 12-29-2003 , 01:50 AM






Hi

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

Response.Clear(
Response.Buffer = Tru
Response.ContentType = "application/vnd.ms-excel
Response.AddHeader("content-disposition", "attachment;filename=CDSInfo.csv"
Response.Charset = "
Me.EnableViewState = Fals
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
Aja


---
Posted using Wimdows.net NntpNews Component - Posted from .NET's Largest Community Website: http://www.dotnetjunkies.com/newsgroups/

Reply With Quote
  #2  
Old   
Jay Adil
 
Posts: n/a

Default Re: Excel data format problem (Urgent) - 12-29-2003 , 02:10 AM






Try to put an apostrophe sign ( ' ) in front of these values.

Jay Adil



"ajaykrishna" <ajaykrishna_salugu@-NOSPAM-conseco.com> wrote

Quote:
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 ?
Quote:
Thanks,
Ajay


---
Posted using Wimdows.net NntpNews Component - Posted from .NET's Largest
Community Website: http://www.dotnetjunkies.com/newsgroups/





Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.