Progress® Telerik® Reporting R3 2021
ReportViewerBase.ExportEnd Event
Occurs when the report exporting in the viewer control is finished.
Namespace:
Telerik.ReportViewer.WinFormsAssembly: Telerik.ReportViewer.WinForms (in Telerik.ReportViewer.WinForms.dll)
Syntax
Examples
This example illustrates how to wire the ExportEnd event.
void reportViewer1_ExportEnd(object sender, Telerik.ReportViewer.Common.ExportEndEventArgs args) { if (null != args.Exception) { //some logic if report processing is not successful } else { //suppress the viewer SaveFileDialog and use your own args.Handled = true; var fileName = args.DocumentName; var extension = args.DocumentExtension; var filter = string.Format("{0} (*.{1})|*.{1}|All Files (*.*)|*.*", fileName, extension); var saveFileDlg = new SaveFileDialog { Filter = filter, FileName = fileName + "." + extension, }; if (saveFileDlg.ShowDialog() == DialogResult.OK) { try { using (var fs = new FileStream(saveFileDlg.FileName, FileMode.Create)) { fs.Write(args.DocumentBytes, 0, args.DocumentBytes.Length); } //Optionally open the file if (!string.IsNullOrEmpty(saveFileDlg.FileName)) { System.Diagnostics.Process.Start(saveFileDlg.FileName); } } catch (Exception) { //Handle exception } } } }
Version Information
Supported in: 1.0.1