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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Problem getting the exportReport() method to work.

Thread ID:





127775 Dec 8,2016 08:56 AM UTC Dec 9,2016 10:49 AM UTC JavaScript 1
Tags: ejReportViewer
Richard Broadley
Asked On December 8, 2016 08:56 AM UTC

Has anyone had any experience getting the exportReport() method of ejReportViewer to export a report?

I have a requirement to embed the ejReportViewer in an application and to allow the user to interact with it (set filters, show/hide columns, etc.) and also to export the report to a pdf document. 
I've got all this working except for the export to pdf.

Yes, I know that this can be done via the report viewer toolbar, but I have a requirement to not show the toolbar and to code the functions that we need, in order to make the embedding look more like the branding we want. According to the documentation as I understand it, the export function can be programmed (https://help.syncfusion.com/api/js/ejreportviewer#methods:exportreport).

The code I put together to try the export is:

    <div id="controls">
        <button onclick="exportRep();">export</button>
    <div id="reportviewer" name="reportviewer"></div>

@section Scripts{

    <script type="text/javascript">

        function exportRep() {
            console.log("exportRep(): start");
            var ejRep = $("#reportviewer").data("ejReportViewer");
            console.log("exportRep(): end");

        function onReportExport(args)
            console.log('onReportExport(): start');
            var exportName = $(args.exportAction).find('#' + this._id + '_exportfileName');
            console.log('onReportExport(): end');

        $(function () {
                reportServiceUrl: "/api/Report",
                reportPath: '62864599-1317-4767-ADE3-ADF47D5CB50C',
                parameters: [@Html.Raw( Model )],
                toolbarSettings: { showToolbar: false},
                exportSettings: { exportOptions: ej.ReportViewer.ExportOptions.Pdf },
                reportExport: "onReportExport"

The report is being displayed with the data passed in to it but clicking the export button, which calls the exportRep() function, just results in the start and end messages being displayed in the JavaScript console. No pdf is being generated.

What am I doing wrong?

Any help would be much appreciated.


Yuvaraj Devarajan [Syncfusion]
Replied On December 9, 2016 10:49 AM UTC

Hi Richard, 

Thanks for contacting Syncfusion support. 
On further analysis of the shared code example, you have not specified any export format type in exportReport() method at your end. Hence the Report is not exported at your end. So we request you to specify the export format type in exportReport() method as show in below code example to avoid the issue at your end.   

<script type="text/javascript"> 
            $(function () { 
                        reportServiceUrl: "/api/ReportApi", 
                        processingMode: ej.ReportViewer.ProcessingMode.Local, 
                        reportPath: '~/ReportTemplate/Product Catalog.rdlc', 
                        toolbarSettings: { showToolbar: false } 
            function exportReport() { 
                var reportviewerObj = $("#container").data("ejReportViewer"); 
                reportviewerObj.exportReport('PDF'); //Exports the reports 

We have prepared a sample and it can be downloaded from, 
Yuvaraj D. 


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