If you became a customer of the Syncfusion� Reporting Platform or the Report Viewer, Report Designer, or Report Writer components before October 2019 and have questions related to those products, you can request support through our forum system. However, please note that this support system is only for existing customers who are still using the Syncfusion� Reporting Platform or its components and not for new customers looking for reporting products from Syncfusion�.

For new customers or those with general reporting questions, we recommend contacting our support team at https://support.boldreports.com/, which is a separate brand created by Syncfusion� for its reporting solutions. Our team will be happy to assist you with any questions you may have.

Thank you for choosing Syncfusion� for your reporting needs.

Error Saving and Exporting Report Files

Hi
I am trying to test ReportWriter with ASP.net Core 2.0 as webservice (.net core based webservice)
I have issue with writer creating 0 byte exported files.
Referenced assemblies are from c:\Program Files (x86)\Syncfusion\Essential Studio\16.1.0.24\Assemblies\.NET Standard 2.0\

I tried the same with ASP.NET MVC  4.6.1, it works properly
The referenced assemblies are V 16.1450.0.24

The report use is attached 

Please let me know what I am missing
Ajay

<code>
[HttpPost]
       public FileResult ExportReport([FromFormstring report_name, [FromFormstring exporttype)
       {
 
           var _m_report_name = report_name;
           var _content_type = "application/octet-stream";
           var _report_name = _m_report_name + @".rdl";
           var _report_path_name = @"~/UserContent/Reports/" + _report_name;
 
           var writerFormat = exporttype;
           if (null == exporttype)
           {
               writerFormat = "PDF";
               _content_type = "application/pdf";
           }
           if (String.Empty == exporttype)
           {
               writerFormat = "PDF";
               _content_type = "application/pdf";
           }
 
           var _server_root = ((IHostingEnvironment)HttpContext.RequestServices.GetService(typeof(IHostingEnvironment)));// EQ to .MapPath(_report_path_name);               
           var _report_mapped_path = _server_root.MapPath(_report_path_name);
 
           if (!System.IO.File.Exists(_report_mapped_path))
           {
               return null;
           }
 
           var fileName = String.Empty;
           WriterFormat format;
           using (var reportWriter = new ReportWriter(_report_mapped_path))
           {
               //reportWriter.ReportProcessingMode = ProcessingMode.Local;
               reportWriter.ReportProcessingMode = ProcessingMode.Remote;
               var _file_ext = ".xls";
               format = WriterFormat.Excel;
 
               if (writerFormat == "PDF")
               {
                   _file_ext = ".pdf";
                   format = WriterFormat.PDF;
                   _content_type = "application/pdf";
               }
               else if (writerFormat == "Word")
               {
                   _file_ext = ".doc";
                   format = WriterFormat.Word;
               }               
               else
               {
                   _file_ext = ".xls";
                   format = WriterFormat.Excel;
               }
 
               fileName = String.Concat(_m_report_nameDateTime.Now.Date.ToString("_yyyyMMdd"), _file_ext);
               var _temp_file = Path.Combine(_server_root.MapPath("~/App_Data"), fileName);//path is mapped correctly
               var _test_file = Path.Combine(_server_root.MapPath("~/App_Data"), "test.txt");
 
               try
               {                    
                   if (System.IO.File.Exists(_temp_file))
                   {
                       System.IO.File.Delete(_temp_file);
                   }
 
                   using (FileStream _temp_file_fs = System.IO.File.Create(_test_file))
                   {
                       using (StreamWriter writer = new StreamWriter(_temp_file_fs))
                       {
                           writer.WriteLine("Example 1 written"); //No problem here
                       }
                   }
                   //Create the file.
                   using (FileStream _temp_file_fs = System.IO.File.Create(_temp_file))
                   {
                       reportWriter.Save(_temp_file_fs, format); //0 byte file created
                   }
 
                   var response = File(_temp_file, _content_type);// // error file not found to client
                   return response;
               }
 
               catch (Exception Ex)
               {
 
                   return null;
               }                
           }
       }
</code>

Attachment: GroupingAgg_4300bd51.7z

7 Replies

MS Mahendran Shanmugam Syncfusion Team April 23, 2018 09:57 AM UTC

Hi Enrochem, 
 
Thanks for contacting Syncfusion support. 
 
On further analysis of the shared code example, the mentioned problem occurs when you have passed the RDL report path in controller and we were unable to load the report path directly specified in controller. So we request to load the report file as a stream in controller method as shown in below code example to avoid the mentioned problem at our end. 
 
            var _server_root = ((IHostingEnvironment)HttpContext.RequestServices.GetService(typeof(IHostingEnvironment)));// EQ to .MapPath(_report_path_name);                            
            var _report_mapped_path = _server_root.MapPath(_report_path_name); 
            FileStream inputStream = new FileStream(_report_mapped_path, FileMode.Open, FileAccess.Read); 
 
            if (!System.IO.File.Exists(_report_mapped_path)) 
            { 
                return null; 
            } 
 
            var fileName = String.Empty; 
            WriterFormat format; 
            using (var reportWriter = new ReportWriter(inputStream)) 
            { 

We have prepared the sample for exporting the RDL file using ReportWriter in ASP.NET Core platform and it can be downloaded from below location. 

Regards, 
Mahendran S. 



EN Enrochem April 27, 2018 03:32 AM UTC

Hi
Thanks
It works with filestream inputs

Ajay


YD Yuvaraj Devarajan Syncfusion Team April 30, 2018 05:15 AM UTC

Hi Enrochem, 

Thanks for the update. We are happy to hear that your issue is resolved. 

Regards, 
Yuvaraj D. 



EN Enrochem November 14, 2018 09:09 AM UTC

Hi

I just updated to V 3.1.0.33 
I am having difficulties in exporting reports with odbc data connection to MySQL
I have MySQL odbc driver 5.3.0.11 installed, both 32 bit and 64bit

If I use full framework, there is no problem
The code is exactly the same.
What could be the issue?

Ajay


MM Mageshyadav M Syncfusion Team November 15, 2018 11:44 AM UTC

Hi Ajay, 
 
In previous updates, you were using Asp.Net Core ReportWriter to export. But now you have mentioned that you have upgraded to 3.1.0.33 Report Platform version. Hence we have doubt over your environment in which the export is not working. Can you confirm the below scenarios in which you are facing the issue ? 
 
  1. Are you exporting from viewer available in ReportServer ?
 
 
 
  1. Are you exporting from standalone Report Viewer sample ?. In case of this scenario used by you, please share the platform you are using such as Asp.Net Core or Asp.Net MVC.
  2. Are you exporting from standalone Report Writer sample ?. In case of this scenario used by you, please share the platform you are using such as Asp.Net Core or Asp.Net MVC.
 
Additionally, please share the issue reproducible RDL file which will be very helpful to validate the mentioned problem at our end. 
 
Regards, 
Mageshyadav.M 



EN Enrochem November 19, 2018 08:59 AM UTC

Hi 
I am still using Asp.Net Core ReportWriter to export
and I have problem in exporting reports when I use updated dll's for Report Writer for ASP.Net Core
The code used remains exactly the same as in this thread.
I am not using report server at all

Regards
Ajay







MM Mageshyadav M Syncfusion Team November 19, 2018 10:15 AM UTC

Hi Ajay, 
 
If you don’t need of ReportServer then we recommend to use the EssentialStudio build versions for Asp.Net Core. The latest version is 2018 Volume 3 SP1 release version 16.3.0.29. 
 
Please find the Asp.Net Core ReportWriter sample referring nugets from 16.3.0.29 version, 
 
 
The above sample generates pdf properly. If the issue still persists using 16.3.0.29 version dlls also, please share us the report which is not exporting properly to validate and provide solution. 
 
Regards, 
Mageshyadav.M 


Loader.
Up arrow icon