Hi,
I was wondering if you could shed any lights on the following issues that I came across with. I attached the solution to this post. In that I subscribed to almost all of the events, because I wanted to play around this a little bit.
Regards,Peter
For Issue 1.
Solution could be use following code
DataPresenterExcelExporter exporter = new DataPresenterExcelExporter(); if (this.dgSelectedLoans.SelectedItems.Count() == 1) { if (MessageBox.Show("Do you want to export selected row only?", Helper.MessageBoxHeader, MessageBoxButton.YesNoCancel) == MessageBoxResult.Yes) { exporter.InitializeRecord += new EventHandler<InitializeRecordEventArgs>(exporter_InitializeRecord); } } exporter.Export(this.dgSelectedLoans, tbExportSelectedLoans.Text,WorkbookFormat.Excel2007); MessageBox.Show("File Exported", Helper.MessageBoxHeader);
Event code.
void exporter_InitializeRecord(object sender, InitializeRecordEventArgs e) { Record obj = e.Record.GetAssociatedRecord(); if (!obj.IsSelected) { e.SkipRecord = true; } }
Regards
Mukesh