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

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

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

3 Replies

YD Yuvaraj Devarajan Syncfusion Team 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. 



GO Greg Obleshchuk May 29, 2017 10:47 AM UTC

That's great , thank-you very much


YD Yuvaraj Devarajan Syncfusion Team 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 


Loader.
Live Chat Icon For mobile
Up arrow icon