Exporting CSV separator

tali

Member
Is it possible to have a TAB separator instead of a comma when exporting a list in CSV format ?
 
Let me explain why it would be interesting to modify the separator : this would allow the user to open directly from the browser his Excel and have the data nicely displayed in each column instead of having everything sticked in just the first column.
 
Did you try to set "Excel CSV" in your export settings?
list/Publishing/CSV
or (if CSV Frontend options=yes) in the export popup
 
Theres no option for a tab separator, but as Troester says the excel format should provide you with the correct separator.
 
As i wanted my users not to have to configure the importation in Excel, but get directly the sheet, i made this hack in
components\com_fabrik\models\csvexport.php

JResponse::setHeader('charset', 'UTF-16LE');
$str = str_replace(',"', ';"', $str);
$str = utf8_decode($str); //at least for fr-FR
JResponse::setBody($str);

Not optimal, but works for me.
 
This is what i get in two pictures :
1- without_hack
2- with_hack

The advantage of the hack is that the user, after clicking the download button sees directly the sheet the right way without having to the process of a) downloading with saving, b) opening Excel blank, c) searching and importing the file with adaptation of the separators and encoding, which he would have to do, at least in a French environment*.

*At the beginning of the thread i asked for a TAB separator. Now M$ uses a ";" separator.
 

Attachments

  • without_hack.png
    without_hack.png
    7.9 KB · Views: 293
  • with_hack.png
    with_hack.png
    6.9 KB · Views: 290
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top