Reports with Asp.Net MVC

8

Hello, I would like to know some reporting options with Asp.Net MVC.

I tried to use the ReportViewer but it is typed with the database and not used for objects.

Would anyone have any suggestions?

Thank you.

    
asked by anonymous 26.10.2015 / 19:36

4 answers

2

Thanks to everyone for the good suggestions I received, but I ended up opting to generate the HTML reports and I'm using MvcRazorToPdf to generate the pdfs.

GitHub project link: link

    
28.12.2015 / 13:01
4

I like iTextShap. It's free and easy to use. I have an example code with mvc in github. Source code for example: link

Videos explaining the use and creation of class for reuse. link

    
16.11.2016 / 03:07
4

A library that I use is selectpdf , which makes it possible to generate pdf reports from css-style html documents, making it much easier to format the generated report.

It has extensive documentation that can be found on your own link site, as well as you you can use it with your free version or your commercial version, the free version with some limitations, but you can do a lot with it.

Example:

// create a new pdf document
PdfDocument doc = new PdfDocument();

// add a new page to the document
PdfPage page = doc.AddPage();

// create a new pdf font
PdfFont font = doc.AddFont(PdfStandardFont.Helvetica);
font.Size = 20;

// create a new text element and add it to the page
PdfTextElement text = new PdfTextElement(50, 50, "Hello world!", font);
page.Add(text);

// save pdf document
doc.Save(Response, false, "Sample.pdf");

// close pdf document
doc.Close();

Using it, a problem you may have and at the time of rendering html page with some model, and to solve this problem you can use the RazorEngine library.

Example:

string template = "Hello @Model.Name! Welcome to Razor!";
string result = Razor.Parse(template, new { Name = "World" });
    
26.10.2015 / 20:53