Report generation in PHP (formats required pdf,xls

2019-03-11 20:07发布

问题:

I need to generate reports in my PHP website (in zend framework)

Formats required:

PDF (with tables & images) // presently using Zend_Pdf
XLS (with tables & images)
DOC (with tables & images)
CSV (only tables)

Please recommend robust and fast solution for generating reports in PHP.

Platform: Zend Framework on LAMP

I know there are some tricky solutions for creating such reports, i wonder is there any open source report generation utility that can be used with LAMP environment

回答1:

Excel: http://www.phpexcel.net



回答2:

In my LAMP based application, I integrated the ability to generate report with JasperReports successfully.

For that, I use PHP/Java Bridge to communicate with Jasper java classes. You might want to try Zend Server since it provide this component at installation time.

Check this blog, it was a source of inspiration for my final solution : http://www.rjohnson.id.au/wordpress/2007/10/27/bullet-proof-jasper-reports-and-php/



回答3:

I'm assuming you mean CSV instead of CVS. For excel and csv files, you can use

header("Content-Type: text/comma-seperated-values");
header("Content-Disposition: inline; filename=\"file.csv";");

and

header("Content-Type: application/vnd.ms-excel");
header("Content-Disposition: inline; filename=\"file.xls";")

respectively. Make sure you turn all formatting off and output only values and comma's for the CSV format, and with the XLS format, you can use regular html tables.