private void ExportGrid() { xls.ExportStructure structure = new xls.ExportStructure(); structure.Tables.Add(table); xls.XlsBiffRenderer renderer = new xls.XlsBiffRenderer(structure); byte[] renderedBytes = renderer.Render(); Response.Clear(); Response.AppendHeader("Content-Disposition:", "attachment; filename=ExportFile.xls"); Response.ContentType = "application/vnd.ms-excel"; Response.BinaryWrite(renderedBytes); Response.End(); }
private void ExportGrid() { foreach (RadGrid grid in gridControlsFound) { grid.AllowPaging = false; grid.CurrentPageIndex = 0; grid.Rebind(); GenerateTable(grid, table); } if (ExportingType.SelectedValue == "2") { structure.Tables.Add(table); } xls.XlsBiffRenderer renderer = new xls.XlsBiffRenderer(structure); byte[] renderedBytes = renderer.Render(); Response.Clear(); Response.AppendHeader("Content-Disposition:", "attachment; filename=ExportFile.xls"); Response.ContentType = "application/vnd.ms-excel"; Response.BinaryWrite(renderedBytes); Response.End(); }