We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback
Essential JS2

Syncfusion jQuery based widgets are no longer in active development. Switch to our pure JavaScript based next generation Essential JS 2 library.

Export in pdf, excel, CSV not working

Thread ID:

Created:

Updated:

Platform:

Replies:

145868 Jul 11,2019 11:54 AM UTC Jul 24,2019 02:33 PM UTC jQuery 8
loading
Tags: ejReportViewer
Alis
Asked On July 11, 2019 11:54 AM UTC

I am using the syncfusion report viewer in my project.  It is working fine except for the export to PDF, CSV etc..  When I click on export, I get the below error:

This localhost page can’t be found

No webpage was found for the web address:http://localhost:58003/api/ApiController/Report/PostReportAction



Below is my code for report viewer:
 public class ReportController : ApiController, IReportController
    {
        //Post action for processing the rdl/rdlc report
        [System.Web.Http.ActionName("PostReportAction")]
        [AcceptVerbs("POST")]
        public object PostReportAction(Dictionary<string, object> jsonResult)
        {
            return ReportHelper.ProcessReport(jsonResult, this);
        }

        //Get action for getting resources from the report
        [System.Web.Http.ActionName("GetResource")]
        [AcceptVerbs("GET")]
        public object GetResource(string key, string resourcetype, bool isPrint)
        {
            return ReportHelper.GetResource(key, resourcetype, isPrint);
        }

        //Method will be called when initialize the report options before start processing the report        
        public void OnInitReportOptions(ReportViewerOptions reportOption)
        {

        }

        //Method will be called when reported is loaded
        public void OnReportLoaded(ReportViewerOptions reportOption)
        {

        }
    }

Below is the javascript calling the controller:

                $("#viewer").ejReportViewer({
                    reportServiceUrl: "/api/ApiController/Report",
                    reportPath: '~/App_Data/GroupingAggregate.rdlc',
                    processingMode: ej.ReportViewer.ProcessingMode.Local,
                    dataSources: [
                        {
                            value: data,

                            name: "Sales"
                        }
                    ],
                });

I have a WebApiConfig where my route is configured as below:
public static void Register(HttpConfiguration config)
        {
            config.MapHttpAttributeRoutes();

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/ApiController/{controller}/{action}",
                defaults: new { id = RouteParameter.Optional }
            );
        }

Any idea why I can't do any export please?  Thanks



Mahendran Shanmugam [Syncfusion]
Replied On July 12, 2019 05:00 AM UTC

Hi Alis, 

The mentioned issue occurs when application did not find the exact web api service when exporting the report. So could you please change your route config and reportservice URL as shown in below code example. 
Global.aspx. 
Old 
New 
public static void Register(HttpConfiguration config) 
        { 
            config.MapHttpAttributeRoutes(); 
 
            config.Routes.MapHttpRoute( 
                name: "DefaultApi", 
                routeTemplate: "api/ApiController/{controller}/{action}", 
                defaults: new { id = RouteParameter.Optional } 
            ); 
        } 

public static void Register(HttpConfiguration config) 
        { 
            config.MapHttpAttributeRoutes(); 
 
            config.Routes.MapHttpRoute( 
                name: "DefaultApi", 
                routeTemplate: "api/{controller}/{action}/{id}", 
                defaults: new { id = RouteParameter.Optional } 
            ); 
        } 


Default.html 
Old 
New 
$("#viewer").ejReportViewer({ 
                    reportServiceUrl: "/api/ApiController/Report", 
                    reportPath: '~/App_Data/GroupingAggregate.rdlc', 
                    processingMode: ej.ReportViewer.ProcessingMode.Local, 
                    dataSources: [ 
                        { 
                            value: data, 
 
                            name: "Sales" 
                        } 
                    ], 
                }); 

$("#viewer").ejReportViewer({ 
                    reportServiceUrl: "/api/Report", 
                    reportPath: '~/App_Data/GroupingAggregate.rdlc', 
                    processingMode: ej.ReportViewer.ProcessingMode.Local, 
                    dataSources: [ 
                        { 
                            value: data, 
 
                            name: "Sales" 
                        } 
                    ], 
                }); 


If issue still persists then could you please share your issue reproducible sample to validate the mentioned problem at our end. 

Regards, 
Mahendran S. 


Alis
Replied On July 12, 2019 07:50 AM UTC

Hi Mahendran ,

Thank you for the help but the problem is still unsolved.  I can hit the action PostReportAction(Dictionary<string, object> jsonResult)
but the return ReportHelper.ProcessReport(jsonResult, this) is giving me the below error:

{StatusCode: 404, ReasonPhrase: 'Not Found', Version: 1.1, Content: <null>, Headers:{}}

Any idea what might be wrong?

Thanks,
Alis





Vinoth Srinivasan [Syncfusion]
Replied On July 12, 2019 03:11 PM UTC

Hi Alis, 
 
We suspect that the issue may occur when missed to add our dependent assemblies, so could you please ensure whether the assemblies mentioned in below link are referred in your application. 
 
 
If you still face any issue, then please share your application with us and it will be helpful for us to provide the solution at the earliest. 
 
Regards, 
Vinoth S. 


Alis
Replied On July 16, 2019 05:41 AM UTC

Hello Vinoth,

I check the assemblies and they are all present in the project.  We changed the syncfusion version to Syncfusion.Web.ReportViewer v16.3.0.21.  For the report viewer, when we export a report, the export is done but then there is a server error "Server cannot set status after HTTP headers have been sent."

We are also having another issue with pdf viewer, after changing the Syncfusion.Web.ReportViewer version:
  1. For the pdf viewer: the plugin load the pdf with the exact number of page but all blank.
  2. To convert a word, docx, to pdf, we have a "ReadTimeout" internal error and the file stream becomes null.

 The version we  are using is Syncfusion.AspNet.Mvc5.PdfViewer v16.4.0.52.

Can you please provide any solutions for those issues?

Vinoth Srinivasan [Syncfusion]
Replied On July 17, 2019 01:04 PM UTC

Hi Alis, 
 
Please find the below response for your queries. 
 
Query 
Response 
I check the assemblies and they are all present in the project.  We changed the syncfusion version to Syncfusion.Web.ReportViewer v16.3.0.21.  For the report viewer, when we export a report, the export is done but then there is a server error "Server cannot set status after HTTP headers have been sent." 
We have checked the mentioned issue with 16.3.0.21 version assemblies, but we were not able to reproduce the mentioned issue. So we have prepared a simple MVC report viewer sample and it can be downloaded from below location. Could you please confirm whether the below sample is working fine at your end. 
 
If issue persists then could you please revert the sample with issue reproducible case to validate the mentioned problem at our end. 
We are also having another issue with pdf viewer, after changing the Syncfusion.Web.ReportViewer version: 
  1. For the pdf viewer: the plugin load the pdf with the exact number of page but all blank.
  2. To convert a word, docx, to pdf, we have a "ReadTimeout" internal error and the file stream becomes null.
 
 The version we  are using is Syncfusion.AspNet.Mvc5.PdfViewer v16.4.0.52. 
 
We suspect the mentioned issue occurs when dependent assembly versions are mismatching. So is this possible for you to modify the sample to reproduce the mentioned issue in above sample. 
 
 
Regards, 
Vinoth S. 


Alis
Replied On July 23, 2019 11:46 AM UTC

Hello Vinoth,

I noticed that for the pdf viewer, when analysing the html generated, that the pdf content is here, but actually is not visible.

Any idea why?

My JS is as below:

                   $("#pdfviewerJs").ejPdfViewer({
                        serviceUrl: '/api/ApiController/PdfViewer',
                        pdfService: ej.PdfViewer.PdfService.Local,
                        serverActionSettings: { load: "Load", fileUpload: "FileUpload", download: "Download" }
                    });
                    var _ejPdfViewer = $("#pdfviewerJs").data("ejPdfViewer");
                    _ejPdfViewer.setModel({ locale: lang });
                    _ejPdfViewer.showDownloadTool(false);
                    _ejPdfViewer.showSignatureTool(false);
                    _ejPdfViewer.load(data["data"]);

Data is the pdf content in base64 string.

Any idea of how to correct it?

The version we are using is Syncfusion.AspNet.Mvc5.PdfViewer v16.4450.0.52.

Thanks.

Alis

Vinoth Srinivasan [Syncfusion]
Replied On July 24, 2019 01:43 PM UTC

Hi Alis, 
 
We are unable to reproduce the reported issue with the details provided in the forum. We have created a sample with the provided code snippet and shared the same in the following location, 
 
 
Please try with this and revert us with the modified sample, culture and the PDF document in which the issue could be reproduced. These details will be helpful for us to investigate further and assist you better. 
 
Regards, 
Vinoth S. 


Lingaraj S [Syncfusion]
Replied On July 24, 2019 02:33 PM UTC

Hi Alis,

You have created this forum thread for ReportViewer export issue but your last query is not related to this thread. If you have new queries related to our other products or the query is not related to this thread then we are recommending to create the new forum for a better follow-up.

Regards,
Lingaraj S.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon