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. Image for the cookie policy date
Starting in 2019, the Reporting control is no longer included in Essential Studio. If you're experiencing issues with the Syncfusion Reporting Platform, Report Viewer, Report Designer, or Report Writer, we recommend migrating to Bold Reports, our dedicated reporting platform.

Bold Reports offers a comprehensive suite of tools and features for all your reporting needs, and we will help you make a smooth transition from the discontinued control. Our support team at https://support.boldreports.com/ is here to assist you with any questions or difficulties you may encounter during the migration process.

We thank you for choosing Syncfusion and appreciate your understanding.

Export ReportViewer to excel sheet is failing

We are planning to buy license for Syncfusion Control but during some sample design for POC I am getting error in Downloading excel file.

I am opening a Reportviewer in ASP.NET MVC.but on export to Excel click it renders the Script body as

<body><pre style="word-wrap: break-word; white-space: pre-wrap;"></pre></body>

and No excel file is downloaded.

My Code is 

View Code 
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
    <title>@ViewBag.Title</title>
    @using Syncfusion.MVC.EJ

    @using Syncfusion.JavaScript.Models

    @using Syncfusion.JavaScript

    <link rel='nofollow' href="@Url.Content("~/Content/ej/web/Default-theme/ej.widgets.all.min.css")" rel="stylesheet" />
    <script src="@Url.Content("~/Scripts/jquery-1.10.2.min.js")"></script>
    <script src="@Url.Content("~/Scripts/jsrender.min.js")"></script>
    <script src="@Url.Content("~/Scripts/jquery.easing.1.3.min.js")"></script>
    <script src="@Url.Content("~/Scripts/jquery.globalize.min.js")"></script>
    <script src="@Url.Content("~/Scripts/ej/ej.web.all.min.js")"></script>
    <script src="@Url.Content("~/Scripts/ej/ej.unobtrusive.min.js")"></script>
</head>
<body>
  
   
    @if (ViewBag.ReportPath != null)
    { 
    <div id="rptContainer" style="height: 750px;width: 850px;min-height:404px; overflow:hidden">
        @(Html.EJ().ReportViewer("reportviewer").ProcessingMode(Syncfusion.JavaScript.ReportViewerEnums.ProcessingMode.Remote)
               .ReportServiceUrl(@Url.Content("~/api/ReportAPI")).Parameters(param =>
               {
                   param.Name("TenantID").Values(new List<string> { Convert.ToString(ViewBag.TenantId) }).Add();
               })
           .ReportServerUrl(Convert.ToString(ViewBag.ServerUrl))
            .ReportPath(Convert.ToString(ViewBag.ReportPath)))

        @(Html.EJ().ScriptManager())
    </div>
    }
    else
    {
        <div>

            The selected Report is not available

        </div>
    }
    @*<p class="pull-right">
        <input class="btn btn-success" data-dissmiss="modal" type="button" value="CLOSE">
    </p>*@
    
    @Scripts.Render("~/bundles/bootstrapOnly")
    @(Html.EJ().ScriptManager())
</body>
</html>

The Controller code is
using Syncfusion.EJ.ReportViewer;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
 public class ReportAPIController : ApiController, IReportController
    {
        public object PostReportAction(Dictionary<string, object> jsonResult)
        {
            return ReportHelper.ProcessReport(jsonResult, this);
        }
        [System.Web.Http.ActionName("GetResource")]
        [System.Web.Http.AcceptVerbs("GET")]
        public object GetResource(string key, string resourcetype, bool isPrint)
        {
            return ReportHelper.GetResource(key, resourcetype, isPrint);
        }
        public void OnInitReportOptions(ReportViewerOptions reportOption)
        {
        }
        public void OnReportLoaded(ReportViewerOptions reportOption)
        {
        }
    }

And Other View Controller

public ActionResult ReportViewer(string reportName, ReportType reportType)
        {
            ViewBag.TenantId = SessionState.TenantID;
            var reportInformation = ReportingServices.GetReportingInformation(reportName, reportType);
            var ServerUrl = Config.GetReportServerUrl;
            var ReportViewer = Config.GetReportViewerName;
            if (reportInformation != null)
            {
                ViewBag.ReportPath = reportInformation.ReportPath;
            }
            return PartialView();
        }

Any help would be appreciated, Thanks for getting throught the post.

3 Replies

VP Venkatesan Pandian Syncfusion Team November 9, 2015 12:08 PM UTC

Hi Vijay,

We are unable to reproduce the reported issue at our end. We suspect this issue might occur due to invalid expression in report. Can you revert us by modifying the sample based on your application along with the replication procedure this would be helpful for us to provide a solution at the earliest.
http://www.syncfusion.com/downloads/support/directtrac/146716/ze/ReportViewerDemo172818681

Regards,
Venkatesan


MI Mithun April 3, 2019 06:02 PM UTC

Hello,

I have similar setup working on my Dev environment using VS2017. 
After i have deployed the application under IIS, When i try to export the data to excel,  i get Page not found error 404 error. 

Note: This issue only happens when exporting to excel. Exporting word, pdf or html format does not have any issues. It works fine.

Version of Syncfusion : 16.2450.0.41


Thanks
Mithun 


VS Vinoth Srinivasan Syncfusion Team April 4, 2019 06:23 AM UTC

Hi Mithun, 

We suspect that the mentioned excel export problem occurs when there is alignment issue in your RDL report file. So could you please share your issue reproducible RDL file to validate the mentioned problem with your shared version. We will validate your report with our local mock up data and update you the details. 

Regards, 
Vinoth S. 


Loader.
Live Chat Icon For mobile
Up arrow icon