degel

degel

  • NA
  • 3
  • 0

problems exporting to xls from asp.net

Sep 25 2003 3:16 PM
has anyone encountered problems exporting datagrids to xls when using office xp as opposed to office 97? i'm using the following sub: (it works great with office 97, but blows up with office xp) Private Overloads Sub btnExport_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnExport.Click 'export to excel Response.Clear() Response.Buffer = True Response.ContentType = "application/vnd.ms-excel" Response.Charset = "" Me.EnableViewState = False Dim oStringWriter As New System.IO.StringWriter() Dim oHtmlTextWriter As New System.Web.UI.HtmlTextWriter(oStringWriter) Me.ClearControls(dg) dg.RenderControl(oHtmlTextWriter) Response.Write(oStringWriter.ToString()) Response.End() End Sub thanks!

Answers (2)