I have a standard RadGridView that I've created functionality to export to Excel. When I filter the rows of the RadGridView and then execute my export button, the spreadsheet still contains all of the rows. How can I export filtered rows only ?
I've already tried ExcelML and that doesn't seem to export to .XLSX format. It does handle the filtering automatically.
Here is my code:
private void radButton_Export_Click_1(object sender, EventArgs e)
{
Cursor = Cursors.WaitCursor;
GridViewSpreadExport spreadExporter = new GridViewSpreadExport(this.radGridView1);
SpreadExportRenderer exportRenderer = new SpreadExportRenderer();
RadOpenFolderDialog FolderDL = new RadOpenFolderDialog();
FolderDL.InitialDirectory = @"\\mansply.local\shares\sales$\";
FolderDL.ExpandToCurrentDirectory = false;
DialogResult FolderDLR = FolderDL.ShowDialog();
if (FolderDLR == DialogResult.OK)
{
string foldername = FolderDL.FileName;
spreadExporter.RunExport(foldername + @"\ExportTest" + "-" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".xlsx", exportRenderer);
}
Cursor = Cursors.Default;
}