help to better help you:

Please: add always Joomla / JEM version and details to your posts, so we can try to reproduce your issue!

[RESOLVED] "My Events" Excel Export Not Divided by Columns

[RESOLVED] "My Events" Excel Export Not Divided by Columns

9 years 9 months ago - 9 years 9 months ago
#22075
When my users click on the "Excel" icon to export and event from the "My Events" screen, it's not comma deliminated, so it's not breaking the username up from the email address and other info into separate columns.

Can someone fix this?
Joomla 3.5.1
JEM 2.1.6 stable (with Customization)
PHP: 5.4.45
Last edit: 9 years 9 months ago by rstarkey.

Please Log in or Create an account to join the conversation.

Re: [RESOLVED] "My Events" Excel Export Not Divided by Columns

9 years 9 months ago
#22081
In /components/com_jem/controllers/attendees.php change
Code:
fputcsv($export, $cols, ';', '"');
(2x) to
Code:
fputcsv($export, $cols, ',', '"');

Change
Code:
header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
to
Code:
header('Expires: ' . gmdate('D - d M Y H:i:s') . ' GMT');
... This will make the date format with a hyphen after the day of the week vs. a comma which would cause an unnecessary column.

Lastly, there should have been a
Code:
JText::_('COM_JEM_EMAIL'),
entered into the column rows headers section when "Emails" are set to display, so I had to manually add that column header.
Joomla 3.5.1
JEM 2.1.6 stable (with Customization)
PHP: 5.4.45
The following user(s) said Thank You: jojo12, Hoffi

Please Log in or Create an account to join the conversation.

Re: [RESOLVED] "My Events" Excel Export Not Divided by Columns

9 years 9 months ago
#22086
Hi Robert,

thanks for your proposal. Generally there is no unique definition of csv format which always expects a comma so our code isn't really wrong. In practice very often a semicolon is used because a comma is more often used within normal data.
Also Excel expects sometimes a comma, sometimes a semicolon, depending on region settings. So if we generally change this other users will protest. Instead we should provide an option to let user choose best matching format.
I hadn't tried it but Excel should understand if you add "sep=;" to first line. Please don't ask me if it must be in front of or can be appended behind the column headers...

Regarding your change on header line:
Are you sure this is required? It's within the html header, not part of the csv data itself. So it should not be shown in Excel sheet. But it could confuse the browser now. The background is to tell the browser "this data has expired now" to ensure it is not cached. So each time you click on the button the browser must send a request to the server to get the actual set of data. Could be your modification let the browser ignore this timestamp and cache the data and you as well as your users wonder where the last changes are...
--- I searched a bit and RFC 2616 clearly says there must be a comma behind the weekday.

Regarding the missed email header string you're right. Seems my eyes were half closed last time I looked into that pice of code... :whistle:

Please Log in or Create an account to join the conversation.

Re: [RESOLVED] "My Events" Excel Export Not Divided by Columns

9 years 9 months ago
#22103
CSV stands for Comma Separated Values - so by default when Excel opens after downloading the file, it's looking for the comma - those making the changes I suggested will now see the data broken into columns with no adverse side effects. Semi-Colon Separated Values would work only if they open Excel first, then click File -> Open and select the Attendees.csv file --- which is the long way around opening the file.

Either way, I just thought I would share the changes I made, and how it worked for me.
Joomla 3.5.1
JEM 2.1.6 stable (with Customization)
PHP: 5.4.45
The following user(s) said Thank You: jojo12

Please Log in or Create an account to join the conversation.

Re: [RESOLVED] "My Events" Excel Export Not Divided by Columns

9 years 9 months ago
#22109
Tnank you for your contributions. I am sure there will be users who are lucky to know this.

Please Log in or Create an account to join the conversation.

Time to create page: 1.704 seconds