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.
Syncfusion Feedback

Can I generate a report in my MVC 5 website without the Report Server

Thread ID:

Created:

Updated:

Platform:

Replies:

130718 May 29,2017 02:38 AM UTC May 30,2017 05:03 AM UTC ASP.NET MVC 3
loading
Tags: ReportViewer
Greg Obleshchuk
Asked On May 29, 2017 02:38 AM UTC

Hello,
I'm looking for a simple way to generate a report in PDF format on my MVC website.  Can I use local processing to generate a PDF of a report?  I don't want to have to deploy a report server

cheers
Greg

Yuvaraj Devarajan [Syncfusion]
Replied On May 29, 2017 10:19 AM UTC

Hi Greg, 

We can achieve your requirement by using ReportWriter control to export the report into PDF, Excel, Word, PPT and HTML directly without using ReportServer in your application as shown in below code example. 

        public ActionResult Index(String writerFormat) 
        { 
            try 
            { 
                string fileName = null; 
                WriterFormat format;                
                HttpContext httpContext = System.Web.HttpContext.Current; 
                ReportWriter reportWriter = new ReportWriter(); 
                reportWriter.ReportPath = Server.MapPath("~/App_Data/GroupingAgg.rdl");                 
                reportWriter.ReportProcessingMode = ProcessingMode.Remote; 
 
                if (writerFormat == "PDF") 
                { 
                    fileName = "GroupingAgg.pdf"; 
                    format = WriterFormat.PDF; 
                } 
                else if (writerFormat == "Word") 
                { 
                    fileName = "GroupingAgg.doc"; 
                    format = WriterFormat.Word; 
                } 
                else if (writerFormat == "Html") 
                { 
                    fileName = "GroupingAgg.Html"; 
                    format = WriterFormat.HTML; 
                } 
                else 
                { 
                    fileName = "GroupingAgg.xls"; 
                    format = WriterFormat.Excel; 
                } 
                reportWriter.Save(fileName, format, httpContext.Response); 
            } 
            catch { } 
            return View()       
        } 

Please refer to the below UG documentation for more detail, 

You can obtain the ASP.Net ReportWriter samples from the below build installed location,   
%userprofile%\AppData\Local\Syncfusion\EssentialStudio\version\MVC\Samples\Web   

Regards, 
Yuvaraj D. 


Greg Obleshchuk
Replied On May 29, 2017 10:47 AM UTC

That's great , thank-you very much

Yuvaraj Devarajan [Syncfusion]
Replied On May 30, 2017 05:03 AM UTC

Hi Greg, 
 
Thanks for your update. We are happy to hear that your requirement is resolved. 
 
Regards, 
Yuvaraj D 


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.

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

;