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.
Unfortunately, activation email could not send to your email. Please try again.

Export ReportViewer to excel sheet is failing

Thread ID:

Created:

Updated:

Platform:

Replies:

121067 Nov 8,2015 08:41 AM Nov 9,2015 07:08 AM ASP.NET MVC 1
loading
Tags: ReportViewer
vijay pratap
Asked On November 8, 2015 08:41 AM

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.

Venkatesan Pandian [Syncfusion]
Replied On November 9, 2015 07:08 AM

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

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.

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.

;