views:

265

answers:

3

I have to make reports with graphics in Excel and PDF from data in a database in an asp.net app. I don't want to use com objects so I have been using Open Xml Sdk to build the excel file from a template file and redirect the response to the new file generated but I don't know how to make the PDF file... I accept any comments about how I can generate the pdf file in my web app... Thanks by the time invested reading this...

+2  A: 

go to this site for pdf.

http://itextsharp.sourceforge.net/

Henry Gao
A: 

I've done this before but with a bit of a cheat.

Office XP and onwards can actually read html files as office documents so if you sent a html document containing a table with the extension and mime type of an excel doc then windows would open it in excel.

From there you can use a web service such as http://www.htm2pdf.co.uk/htm2pdf-web-service.aspx to convert the html table data into a pdf.

Even better than that if you change the extension of a docx or xslx file to zip you can unzip the stored files and you'll find they are xml files that you can edit and rezip (changing the extension back of course).

Matt Smith
A: 

The easiest solution -- in my opinion -- is to use Client Report Definition Files. After you defined reports, you can

  • show them to users in your ASP.NET application using the ReportViewer component (Google for asp.net ReportViewer),
  • export them directly to Excel (Google for localreport excel),
  • export them directly to PDF (Google for localreport pdf).

For the last two options, you can either save the file to disk or send it directly to the asp.net client (again, there are lots of code examples on the web).

Heinzi