Export of the report

Hello,
 I used the export functionality in the viewer to export the dashboard (different formats - excel, pdf, ..). ( https://help.syncfusion.com/dashboard-platform/dashboard-designer/previewing-dashboard/dashboard-settings#exporting-dashboard-to-excel )
I have two connected issues with that:
1) I am not able to find the exported file
2) I cannot set the path where the file should be stored, I didn't event find an argument for that in the documentation of the export function

Can you please help me?
Thanks

3 Replies

SU Suriya Syncfusion Team October 10, 2018 11:16 AM UTC

Hi Ondrej, 
 
We have support to export (to PDF, Excel and Image) the dashboard in Dashboard Viewer and the output file downloaded from the Dashboard Service which is being handled by downloading event of respective web browser.  
 
We believe that you have tried to export using CefSharp Web browser either in WPF/Windows Forms sample with embedded Dashboard Viewer. For this case, 
 
You can handle the exporting at the sample level using the CefSharp browser’s Download Handler method. The following prerequisites are required to implement the same   
  
1.       .NET Framework 4.5.2  
2.       CefSharp 63.0.3.0  
 
Follow the below steps to achieve your requirement:  
 
 
1.       Update your Application .NET Framework version as 4.5.2. Refer the link to know how to update the .NET version  
2.       Install the CefSharp NuGet from the link https://www.nuget.org/packages/CefSharp.WinForms/  
3.       To make sure you have installed all the needed dependencies please refer the link  
4.       Please refer the below code snippet. Using the below code snippet the download can be handled  
     
using CefSharp;   
using System.Windows.Forms;   
…………………………………   
   
this.WindowBrowser.DownloadHandler = new DownloadHandler();  // Assign the new instance of the Download Handler to web chromium browserinstance   
   
………………………………………………..   
      public class DownloadHandler : IDownloadHandler   
        {   
            public void OnBeforeDownload(IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)   
            {   
   
                if (!callback.IsDisposed)   
                {   
                    using (callback)   
                    {   
                        SaveFileDialog saveFileDialog = new SaveFileDialog();   // using the win forms show dialog save the file   
                        saveFileDialog.FileName = downloadItem.SuggestedFileName;   
                        saveFileDialog.Filter = "|*" + System.IO.Path.GetExtension(saveFileDialog.FileName);   
   
                        if (saveFileDialog.ShowDialog() == DialogResult.OK && saveFileDialog.FileName != "")   
                        {   
                            downloadItem.SuggestedFileName = saveFileDialog.FileName;   
                        }   
                        callback.Continue(downloadItem.SuggestedFileName, showDialog: false);  // Callback until the download is completed   
                    }   
   
                }   
            }   
   
            public void OnDownloadUpdated(IBrowser browser, DownloadItem downloadItem, IDownloadItemCallback callback)   
            {   
   
                if (downloadItem.IsComplete || downloadItem.IsCancelled) {   
                    return;                                         // once the download is completed stop the process   
                }   
                      
            }   
   
        }   
   
   
 
Note : Recommended version to implement the exporting is CefSharp 63.0.3 since the previous version may throw the error will opening the File Save Dialog.  
If you have already prepared the Win Forms sample by referring the UG link (https://help.syncfusion.com/dashboard-platform/dashboard-sdk/getting-started/windows-forms#generating-url) then, remove the below lines in the Main method of the Program Class to initialize the ChromiumwebBrowser because these lines won’t work in the newer CefSharp Version (63.0.3).  
 
    
//Comment or remove the below lines at Program.cs as don’t require in CefSharp v63.0.3  
if(!Cef.Initialize(settings))   
   {  
                  if(Environment.GetCommandLineArgs().Contains("--type=renderer"))  
                    Environment.Exit(0);  
   }  
  
We have also created the sample in WinForms for your reference in the below link:  
  
  
Please let us know if your case is different than above or if you need any further assistance.   
 
Regards, 
Suriya 



OV Ondrej V October 10, 2018 12:27 PM UTC

Perfect, thank you. It is exactly what I was looking for. I forgot to mention that we are using CefSharp, but you guessed it completely right.


SU Suriya Syncfusion Team October 10, 2018 12:59 PM UTC

Hi Ondrej, 

Thank you for your reply. 

Regards, 
Suriya 


Loader.
Up arrow icon