I'll be sending a patch in a few minutes to allow for the use of the PHPExcel (http://phpexcel.codeplex.com/) library. The library allows for more portable .xls exports, that work with OpenOffice, LibreOffice, MS-Office 97, 2003 and 2007.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ywarnier’s picture

Status: Active » Needs review
FileSize
18 KB

Attaching the patch. This is the fruit of collaborative work between @albert1t0, @rcechang, @chaskytux, @xjkwak and myself during the Drupal Code Sprint Perú May 2011: http://groups.drupal.org/node/144519

Note: there are still a few Windows end-of-line markers apparently, I haven't been able to remove them, but appart from that the patch is functional and respects all other Drupal coding conventions. Built on the dev version of 6.x-1.x branch (apparently not different from master).

creaoy’s picture

Hi,

I can give you access to the project and you can release this as second dev version.

Will this work for you? I just don't have time to work on this now.

Thanks, Johnny

ywarnier’s picture

Why not... don't have much time either but I'll try to make some space for that over the week-end.

morbiD’s picture

A note to anyone trying to test this patch: Make sure to clear all your caches after patching and setting up a PHPExcel view. Otherwise, you might get "Page not found" errors when you try to access your PHPExcel feed.

Anyway, I've just tried it out and it seems to work well.

ywarnier’s picture

FileSize
13.93 KB

Haven't had time to patch and submit yet, but for the impatient, I thought I might just upload a small package with my latest improvements for now (there was a bug when having more than 26 columns and passing over the "Z" column label - now fixed).

Please note that you still need to download the phpexcel library from Codeplex: http://phpexcel.codeplex.com/ (huge file) and unzip it in the sites/all/libraries/ directory.

sylvaticus’s picture

Hello, after installing the module in #5 (rm -rf [old]) I have a WSOD in /admin/settings/views2excel

With the WSOD module I got this message:
array(4) { ["type"]=> int(64) ["message"]=> string(194) "require_once() [function.require]: Failed opening required 'sites/all/modules/views_export_xls/views_export_xls.admin.inc' (include_path='.:/usr/local/share/pear')" ["file"]=> string(51) "/www/agriregioni/elearning/drupal/includes/menu.inc" ["line"]=> int(347) } n/a

sylvaticus’s picture

ok.. in the provided tgz the file is "view_export_xls.admin.inc" instead of "views_export_xls.admin.inc" (with the s).
Simple renamed and it works, but still it cant's see the phpexcel class I placed in /sites/all/libraries/ ???

ywarnier’s picture

Hi Sylvaticus,
Sorry for the delay. Thanks for spotting the "s" problem (don't know how I could have missed it). The view is available as a "feed" display, then you have to pick "phpexcel". Hope this is what you were looking for.

ywarnier’s picture

... and the library has to be in sites/all/libraries/phpexcel/ (it looks for sites/all/libraries/phpexcel/Classes/PHPExcel.php)

RobertoGA’s picture

FileSize
56.11 KB

Hi ywarnier,

Thanks for patch it.

PHPExcel.php is readable at 'sites/all/libraries/phpexcel/Classes' but the module doesn't see it and then... I cannot use it. Someone has this problem before? Attach a screenshot of the admin site.

steveoliver’s picture

Here's a patch against 6.x-1.x (dbdb6af) with changes from @ywarnier's #5, plus README.txt instructions to install the PHPExcel library ...and some whitespace fixes.

This patch adds the PHPExcel Feed output style option, in addition to the module's original XLS Feed output style.

This PHPExcel Feed output style produces .xls files that work for me in more than just MS Excel.

bernman’s picture

Before diving into this myself, can you predict what issues would arise trying to apply this patch to the Drupal 7 version of the plugin?

Many thanks in advance.

ywarnier’s picture

Hi Bernman,

The plugin is an output extension, so there pretty much no risk at all in adding it (maybe it will generate a few "not found errors" initially, but these should be easy to fix, and then it might not work, but this shouldn't affect the rest of your site).

creaoy’s picture

I think i will add an option to use phpexcel if module http://drupal.org/project/phpexcel enabled.
What do yo think?

creaoy’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
ywarnier’s picture

I didn't know the phpexcel module. Apparently it also requires the download and installation in sites/all/libraries of th phpexcel library, so there's not much of a benefit to requiring it, but it's probably nicer to let them handle the dependency.

creaoy’s picture

Status: Needs review » Needs work

Ok. I will add this in my TODO list.

morbiD’s picture

It seems like the only reason to use the phpexcel module is if you want to use the limited API that it provides.

Otherwise, I would have thought the libraries module would be a better option for managing the PHPExcel library and any other libraries you might wish to support, especially if you wanted to include more output control options in the views style plugin, such as options for cell width and text wrapping on columns or rows, which the phpexcel module's API doesn't appear to support.

In fact, it might be worth offloading the php-excel library as well, given the reasoning here: http://drupal.org/node/1342220#libraries-seperate, but that's a separate issue I guess.

igor.ro’s picture

Status: Needs work » Needs review

I made this port
you can find code here
https://github.com/goruha/views_export_xls
branch 7.x-2.x

Could you merge it to drupal.org project?
Thanks.

dromansab’s picture

Hi,

Thanks for your port. It works so good.

Can you tell me how I can define the height and width of cells? I would set an automatic height and width depending on the field content.

Thanks!