StiSLViewerControl - too many clicks to export

Stimulsoft Reports.Silverlight discussion
Post Reply
vecs
Posts: 1
Joined: Tue Jul 12, 2016 2:21 pm

StiSLViewerControl - too many clicks to export

Post by vecs » Thu Jul 14, 2016 10:08 am

There are too many clicks required to export report to PDF or Excel from StiSLViewerControl.
Is it possible to reduce clicks number by excluding "Export settings" dialog (use default export settings) and intermediate one-botton dialog?

Here is my current code:

Code: Select all

...
Stimulsoft.Report.StiOptions.Silverlight.WCFService.UseWCFService = true;
...
        private void WCFService_WCFExportDocument(object sender, Stimulsoft.Report.Events.StiWCFExportEventArgs e)
        {
            if (sender != this.viewer)
                return;

            string exportFilter = e.Filter;
            (sender as Stimulsoft.Report.Viewer.StiSLViewerControl).StartProgressInformation("In progress", "Exporting", Visibility.Visible);

            var serv = new ReportServ(); //remote WCF service wrapper

            InvokeOperation<byte[]> result = serv.ExportDocument(e.Xml); //Export (server-side)

            result.Completed += (send, args) =>
            {
                (sender as Stimulsoft.Report.Viewer.StiSLViewerControl).CloseProgressInformation();
                service_ExportDocumentCompleted(send, new ExportDocumentCompletedArgs(result.Value, result.Error), exportFilter);
            };

        }

        private void service_ExportDocumentCompleted(object sender, ExportDocumentCompletedArgs e, string exportFilter)
        {
            if (e.Error == null && e.Result != null)
            {
                //SaveFileDialog could be launched by UI-event only (user click)
                //So intermediate dlg with button required
                var window = new SaveWindow();
                window.OKButton.Click += delegate
                {
                    window.Close();

                    SaveFileDialog saveFileDialog = new SaveFileDialog
                    {
                        Filter = string.Format("Document export (*.{0})|*.{0}", exportFilter)
                    };

                   saveFileDialog.DefaultFileName = CurrentReportName;

                    if (saveFileDialog.ShowDialog() == true)
                    {
                        var stream = saveFileDialog.OpenFile() as FileStream;
                        stream.Write(e.Result, 0, e.Result.Length);

                        stream.Flush();
                        stream.Close();
                        stream.Dispose();
                    }
                };

                window.Show();
            }
        }
Alex K.
Posts: 6489
Joined: Thu Jul 29, 2010 2:37 am

Re: StiSLViewerControl - too many clicks to export

Post by Alex K. » Fri Jul 15, 2016 12:32 pm

Hello,

Please send us a request on support@stimulsoft.com with detail description.

Thank you.
Post Reply