Below code works fine in all versions but throwing a warining in 2007 excel . please help i want to expot to excel in all versions.
Response.Clear();
Response.Buffer = true;
Response.ContentType = "application/vnd.ms-excel";
Response.Charset = "";
this.EnableViewState = false;
Response.AddHeader("Content-Disposition", "attachment; filename=Goals.xls;");
System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
ViewAuditHistory();
this.ClearControls(gvAuditHistory);
gvAuditHistory.RenderControl(oHtmlTextWriter);
Response.Write(oStringWriter.ToString());
Response.End();
Giri