Exporting datagrid to excel: Format cells?
I'm exportin a datagrid to excel, but Excel file is without format colors cells border...
Do you know how format it?
thanks
this is my code:
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=exportar.xls");
Response.Buffer= true;
Response.ContentType = "application/vnd.ms-excel";
Response.Charset = "";
this.EnableViewState = false;
System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
dgNopaginado.Caption= ddPlanta.SelectedItem + ": "+ txtFechaIni.Fecha+"-"+txtFechaFin.Fecha;
this.ClearControls(dgNopaginado);
dgNopaginado.RenderControl(oHtmlTextWriter);
Response.Write(oStringWriter.ToString());
Response.End();