N
Not Me
Hi, I use the following code to export a prepared gridview control as an
excel spreadsheet.
***
Response.ContentType = "application/vnd.ms-excel"
Response.Charset = ""
Me.EnableViewState = False
Dim tw As New System.IO.StringWriter()
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
Dim frm As HtmlForm = New HtmlForm()
Me.Controls.Add(frm)
frm.Controls.Add(gvSearch)
frm.RenderControl(hw)
Response.Write(tw.ToString())
Response.End()
***
Now it all works great, however in the gridview I have some text fields
which feature leading 0s. When exported, excel decides they should be
stored as numbers, and therefore the leading 0s are gone.
What's the best way to avoid this? more code in the above, or altering
the data in the gridview?
Cheers for any help,
Chris
excel spreadsheet.
***
Response.ContentType = "application/vnd.ms-excel"
Response.Charset = ""
Me.EnableViewState = False
Dim tw As New System.IO.StringWriter()
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
Dim frm As HtmlForm = New HtmlForm()
Me.Controls.Add(frm)
frm.Controls.Add(gvSearch)
frm.RenderControl(hw)
Response.Write(tw.ToString())
Response.End()
***
Now it all works great, however in the gridview I have some text fields
which feature leading 0s. When exported, excel decides they should be
stored as numbers, and therefore the leading 0s are gone.
What's the best way to avoid this? more code in the above, or altering
the data in the gridview?
Cheers for any help,
Chris