Closed (fixed)
Project:
Views Bonus Pack
Version:
6.x-1.x-dev
Component:
Views Export
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
24 May 2008 at 20:02 UTC
Updated:
7 Feb 2011 at 18:25 UTC
Jump to comment: Most recent
Comments
Comment #1
oplachko84 commentedComment #2
enboig commentedIs this going to be ported to drupal6?
Comment #3
aren cambre commentedIs this even worthwhile? Excel can readily import XML data.
Comment #4
Gerald Mengisen commented>>Is this even worthwhile? Excel can readily import XML data.
Sure, but will users get the idea to open the XML with Excel? I doubt it. It is far more intuitive to offer a direct Excel export. CSV Export comes close, but doesn't allow you to specify the character encoding and so for most users, umlauts and accents would end up garbled.
So these days I'll post a patch. I have this working for D5 and now I'm about to port it to D6.
Comment #5
enboig commentedI agree with #4; I have encoding problems. One solution would be adding encoding option to CSV; but then some programs would default to UTF8 and others to ISO-8859, ANSI, ....
+1 to HTML option if this works on excel (I suppose I will have to change extension to .xls to make the trick work). I will also check openoffice afterwards.
Comment #6
anrikun commentedPlease review my file with Excel export
http://drupal.org/node/444412
Comment #7
anrikun commentedComment #8
Gerald Mengisen commented@anrikun: thanks for your contribution; I'll check on the week-end if I can turn it into a patch.
@enboig: in the D5 version, it worked fine with OpenOffice; I don't have Excel. The whole trick is to include the html header with the meta tag that contains the character encoding.
===
Meanwhile, somebody created a new module for Excel export:
http://drupal.org/project/views_export_xls
The views bonus pack is a dependency of that module; therefore, I'd prefer if the Excel export goes directly into the Views Bonus pack - one module less to install.
Comment #9
aren cambre commentedI asked him to merge: #496652: Please merge with Views Bonus Pack.
Comment #10
anrikun commentedActually the way http://drupal.org/project/views_export_xls creates XLS files is better than mine as it seems to use the real binary XLS format and not the HTML format like mine.
The problem is that there are issues with multibyte characters and HTML entities.
Comment #11
Gerald Mengisen commented@anrikun
After having tried out http://drupal.org/project/views_export_xls , I agree that it is the superior method. It also seems that accents and umlauts come across just fine.
Nevertheless, I tried to create a patch for your solution, but I'm a bit at loss what to do for new files despite the descriptions at http://drupal.org/patch/create . So for now this takes more time than I have. Sorry.
Comment #12
aren cambre commentedJust to be clear, and responding to #10 and #11, I am asking to replace this project's current XLS export with the XLS export in http://drupal.org/project/views_export_xls.
Comment #13
anrikun commentedBut http://drupal.org/project/views_export_xls has many issues and should be used only when dealing OK with UTF-8 characters, HTML entities, and also "rowspans": if in a row, a CCK field has multiple values, views_export_xls creates one line for each field value, without any rowspan on the other single value fields.
Besides, there are better XLS export libraries than the one views_export_xls uses:
http://pizzaseo.com/php-excel-creator-class
This library seems really complete and supports UTF-8.
Comment #14
creaoy commentedWill be good to create good solution.
anrikun : We can work together on this.
Comment #15
anrikun commentedOk JK.
Can you have a look at http://pizzaseo.com/php-excel-creator-class ?
Actually, the file to download is: http://pizzaseo.com/files/articles/excel.zip
It seems to be a good class to use.
But maybe there are others even better...
Comment #16
neclimdulThere isn't anything to review here...
Comment #17
Anonymous (not verified) commentedcsv export works veri well, but people using MS excel have to use text-to-column function to get the data properly displayed.
xls export give WSOD
Comment #18
aren cambre commentedThis is issue is not about a bug.
Comment #19
appel commentedSubscribing.
Comment #20
bendiy commentedThe nice thing about HTML table exports vs. direct data exports is that Excel will recognize the HTML Table's formatting. This works for the following:
All of these features make the HTML Table Excel export much more user friendly. Your users can start to use it, email it and read it immediately. A direct data export like Views_Excel_Export does not persevere all of this info. You have to reformat all of the data in Excel before it's readable and usable.
I don't know if you can preserve the format with a direct data export by adding features to Views_Excel_Export from some libraries. However, at the moment, I see the current HTML Table export more valuable than the Views_Excel_Export.
Comment #21
bendiy commentedI've created an updated patch to export to Excel via the HTML table option mentioned above. Please download and review from Issue #519424.
Comment #22
neclimdulOk, guys, this thread has gotten pretty hard to follow with all the different questions and requests. I think we can follow up with the following issues and close this issue down.
#496652: Please merge with Views Bonus Pack - Merge Project views_export_xls
#519424: Export to Excel - HTML XLS Export for views_bonus
As far as the other libraries go, I'm not sure I'm comfortable adding those as requirements for a plugin. Extra downloads are always confusing and at this point views_bonus is a very simple set of modules to build on top of.
Comment #23
mag2000 commentedThis code export the data as well as all the primary,navigation header and footer in excel as well. I past this code in body of the page. The same code is working fine in php. But when i copied the same to drupal. It will not work as i required. Anybody has a clue...what's wrong...thanks in advance.
(cut the code of the connection string , query is working)
<?PHP
$filename = 'test.xls';
drupal_set_header('Content-Type: application/octet-stream');
drupal_set_header('Content-Disposition: attachement; filename=' . $filename);
$flag = false;
$result = mysql_query("SELECT symbol,price FROM price") or die('Query failed!');
while(false !== ($row = mysql_fetch_assoc($result))) {
if(!$flag) {
// display field/column names as first row
echo implode("\t", array_keys($row)) . "\n";
$flag = true;
}
//array_walk($row, 'cleanData');
echo implode("\t", array_values($row)) . "\n";
}
?>
Comment #24
anrikun commentedThis issue is closed.
Please post this as a new support request.