Hi James,
The problem has been resolved and the fix will appear on March 30, 2021, with the R1 2021 SP2 release.
Kind regards,
Doncho
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.
Workaround for the issue:
C# code:
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
if (e.CommandName == RadGrid.ExportToExcelCommandName)
{
//prevent the default exporting
e.Canceled = true;
//generate Workbook out of the Grid for exporting
DPL.Workbook workbook = RadGrid1.MasterTableView.GenerateXlsxOutput<DPL.Workbook>() as DPL.Workbook;
DPL.Worksheet worksheet = workbook.ActiveSheet as DPL.Worksheet;
//remove the command item from the exported workbook
var commandRowIndex = 0;
DPL.RowSelection commandRow = worksheet.Rows[commandRowIndex];
commandRow.Remove();
//alternative approach to remove the command item
//RadGrid1.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None;
//RadGrid1.Rebind();
//remove the filter item from the exported workbook
var filterRowIndex = 1;
DPL.RowSelection filterRow = worksheet.Rows[filterRowIndex];
filterRow.Remove();
//export and send to the browser as response
byte[] data;
using (MemoryStream ms = new MemoryStream())
{
var provider = new XlsxFormatProvider();
provider.Export(workbook, ms);
data = ms.ToArray();
}
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
Response.Headers.Remove("Content-Disposition");
Response.AppendHeader("Content-Disposition", "attachment; filename=" + RadGrid1.ExportSettings.FileName + ".xlsx");
Response.BinaryWrite(data);
Response.End();
}
}
Kind regards,
Doncho
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.