Posted 1 September 2022, 4:12 pm EST
Hi,
You need to add C1.WPF.DataGrid.Excel.4.5.2 dll into the references of your project solution and import the namespace C1.WPF.DataGrid.Excel. Then, you can call save method of C1DataGrid to export DataGrid to Excel.(see code snippet)
var dlg = new Microsoft.Win32.SaveFileDialog();
dlg.DefaultExt = "xlsx";
dlg.Filter = "Excel Workbook (*.xlsx)|*.xlsx";
if (dlg.ShowDialog() == true)
{
grid.Save(dlg.FileName, FileFormat.Xlsx);
}
Please refer the attached sampe for the same : DataGridExcelExport.zip
Best Regards,
Nitin