Export to excel leaves off leading 0s
- From: "Elton Wang" <anonymous@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 9 Apr 2005 11:12:23 -0700
I suppose the data in the first column is something like
0868. The excel is identify (too smart) data type of the
column as numeric.
Elton Wang
elton_wang@xxxxxxxxxxx
>-----Original Message-----
>When I export a datagrid to excel the leading 0s of the
first column are
>truncated. I am using the following code for the export:
>
>private void ExportToExcel()
> {
> Response.Clear();
> Response.Buffer = true;
> Response.ContentType
= "application/vnd.ms-excel";
> Response.Charset = "";
> this.EnableViewState = false;
> StringWriter tw = new StringWriter
();
> HtmlTextWriter hw = new
HtmlTextWriter(tw);
> reportGrid.Width = 800;
> hw.RenderBeginTag
(System.Web.UI.HtmlTextWriterTag.Html);
> //this.ClearControls(reportGrid);
> reportGrid.RenderControl(hw);
> hw.RenderEndTag();
> Response.Write(tw.ToString());
> Response.End();
> }
>
>How do I need to alter the code to prevent the truncation?
>
>--
>Message posted via http://www.dotnetmonster.com
>.
>
.
- References:
- Export to excel leaves off leading 0s
- From: Dave Bailey via DotNetMonster.com
- Export to excel leaves off leading 0s
- Prev by Date: Re: Need to change image of imagebutton in datagrid template column
- Next by Date: sorting problem!
- Previous by thread: Export to excel leaves off leading 0s
- Next by thread: ds and Session
- Index(es):
Relevant Pages
|