This is a migrated thread and some comments may be shown as answers.

ReportViewer

2 Answers 51 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Marc-Andre
Top achievements
Rank 1
Marc-Andre asked on 06 Jul 2018, 09:39 PM

Hi,

Is it possible for the ReportViewer to use your RadSaveDialog during exportation.

 

Thanks

Marc

2 Answers, 1 is accepted

Sort by
0
Ivan Hristov
Telerik team
answered on 09 Jul 2018, 08:33 AM
Hi Marc,

Yes, you can handle the ReportViewer's ExportEnd event and override the default behavior as shown below:

public Window1()
{
    InitializeComponent();
 
    this.ReportViewer1.ExportEnd += ReportViewer1_ExportEnd;
}
 
private void ReportViewer1_ExportEnd(object sender, Telerik.ReportViewer.Common.ExportEndEventArgs args)
{
    args.Handled = true;
 
    var fileDialog = new RadSaveFileDialog()
    {
        Owner = this,
        FileName = args.DocumentName,
        DefaultExt = args.DocumentExtension
    };
 
    if (fileDialog.ShowDialog() == true)
    {
        using (var stream = fileDialog.OpenFile())
        {
            stream.Write(args.DocumentBytes, 0, args.DocumentBytes.Length);
        }
    }
}


Regards,
Ivan Hristov
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Marc-Andre
Top achievements
Rank 1
answered on 14 Jul 2018, 07:00 PM

Hi Ivan,

Work perfectly !!

Thanks
Marc

Tags
General Discussions
Asked by
Marc-Andre
Top achievements
Rank 1
Answers by
Ivan Hristov
Telerik team
Marc-Andre
Top achievements
Rank 1
Share this question
or