protected void btnExcel_Click1(object sender, ImageClickEventArgs e) { Response.Clear(); Response.AddHeader("Content-Disposition", "attachment;filename=AttandanceReport.xls"); Response.Charset = ""; Response.ContentType = "application/vnd.xls"; System.IO.StringWriter stringWrite = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite); // grdreport1.BorderStyle = BorderStyle.Solid; // grdreport1.BorderWidth = 1; // grdreport1.BackColor = Color.WhiteSmoke; // grdreport1.GridLines = GridLines.Both; grdreport1.Font.Name = "Verdana"; grdreport1.Font.Size = FontUnit.XXSmall; // grdreport1.HeaderStyle.BackColor = Color.DimGray; // grdreport1.HeaderStyle.ForeColor = Color.White; grdreport1.RowStyle.HorizontalAlign = HorizontalAlign.Center; grdreport1.RowStyle.VerticalAlign = VerticalAlign.Top; grdreport1.RenderControl(htmlWrite); Response.Write(stringWrite.ToString()); Response.End(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)