PrestaShop/PrestaShop — pull request #738 by dlage (2013-09-23 20:10:03+00:00)
Title: Export to excel (.xlsx files)

There are a lot of problems using the CSV export features when opening in Excel.
Because of that I decided to go ahead and, using the new AdminController base feature for exporting data, I created another action that exports directly to .xlsx files.
This takes care of all the issues that people recurrently have when trying to open CSV files in Excel (prices with "wrong" format, encoding issues and so on...).
I used a very stable library, [PHPExcel](http://phpexcel.codeplex.com/), which is also [available on Github](https://github.com/PHPOffice/PHPExcel). I used the latest stable release.
I decided to keep it simple and use the approach already done for csv export.

This just fixes the issues for the admin controllers that use the export feature in the [AdminControllerCore](https://github.com/PrestaShop/PrestaShop/blob/development/classes/controller/AdminController.php) class.
I believe there's already some effort being made to centralize all the export actions, so I think that applying the same logic to some parts of the base code that still build the CSV in a "custom way" (which results in many issues from encoding to htmlentities issues). Namely, I'm referring to most of the Advanced Stock controllers.

Hope you enjoy. I'm open to discussion, of course.

Some points that should be revised:
* the phpexcel library is inside the `tools` folder (seemed like the correct place);
* the `require_once` needed to load `PHPExcel` is done inside the `processExportExcel` function (I tend to use this to avoid causing issues in other parts of the application that "have nothing to do with it");
* there are a lot of features/improvements that could be done using this lib - create header tables, export multiple sheets;
* this lib could also be used to create the CSV output files - abstracts from encoding/separator/formatting issues;
* I included the complete library but it really doesn't need all of it. Still, it might be useful.