Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which is the best way to generate excel output in PHP? [closed]

Is there any other PHP components like PHPExcel?

like image 425
Rodex Avatar asked May 15 '12 06:05

Rodex


People also ask

How do I convert a table of contents to Excel in PHP?

php $file="demo. xls"; $test="<table ><tr><td>Cell 1</td><td>Cell 2</td></tr></table>"; header("Content-type: application/vnd. ms-excel"); header("Content-Disposition: attachment; filename=$file"); echo $test; ?>

How do I keep zeros in cells when exporting from PHP to Excel?

You can type an apostrophe (') in front of the number, and Excel will treat it as text. So: echo '"' . $d['nom'] .


1 Answers

There is some class that generates PHP Excel files (real excel files, not that .csv thing). I use (DEPRICATED) See edit 2:

https://github.com/PHPOffice/PHPExcel

BUT: I have had a problem when trying to read these generated excel files with the java excel READER, so there might be bugs in this PHP script.

  1. EDIT: Nice one: http://www.phpclasses.org/package/2037-PHP-Generate-spreadsheet-files-Excel-xls-XML-format.html

  2. PhpSpreadsheet is the next version of PHPExcel. It breaks compatibility to dramatically improve the code base quality (namespaces, PSR compliance, use of latest PHP language features, etc.). https://github.com/PHPOffice/PhpSpreadsheet

like image 73
Sliq Avatar answered Oct 06 '22 21:10

Sliq