Forums

CSV Export - Line Break Problem

bytekultur 22 Aug, 2012
Hello
First of all - thank you very much for this great action!! I really like it and with a bit of search I was able to change the delimiter.

But now i have a problem i can't fix by myself.

One of the fields that is getting exported is a text filed - with linebreaks and everything. that filed is always on more then one line in excel (see attached image - line 4, 6 and 7 are wrong). I also have a problem with the ä, ö, ü in the German language.

For any tip how I can change this problem I'm very thankful!

all the best,
Maya
GreyHead 22 Aug, 2012
Hi Maya,

The character set problem is probably because you are not importing the data using the correct Character set. Try setting the import to UTF-8.

And I think that the line-break problem is because you are opening the file as a text file and not importing it as a CSV file. Try using the 'From Text' option on the Data tab to import the file.

Bob
bytekultur 22 Aug, 2012
Unfortunately it is not working like that – I try to open it in many different ways and always have the same problem...
when i look at the data in the backend they look alright... hmmmm...

but thank you anyway for your quick replay!
GreyHead 22 Aug, 2012
Hi bytekultur ,

Please post a copy of the CSV file here (you may need to rename it to .txt to upload it)

Bob
bytekultur 22 Aug, 2012
thank you very much - i still have not found the solution by myself

(after we found the solution - i deleted the file)
GreyHead 22 Aug, 2012
Hi bytekultur,

This is possible but not all that simple. You can't have line-breaks inside a CSV file - they are used to mark a new record.

To get round this you need to pre-process the 'situation' data to replace the line breaks with something else. The PHP nl2br() function is helpful and will insert <br> tags.

To fix the character problems you need to set the import language to UTF-8. But the pipe character | doesn't work as a separator if you do this. I used # instead.

With these changes the file will import into Excel correctly.

If you need to put the line-breaks back into the 'situation' column then you can replace <br> with Alt+010

Bob
bytekultur 23 Aug, 2012
Thank you very much for your quick help - i'm a bit bussy the next two days - will try to find the solution next week. i will tell my "result" :-)

Thanks again - your tips are really helpful!!!
bytekultur 29 Aug, 2012
Soo - now everything is working! thanks a lot!!!

for the community thought (i don't know if you need this) i paste the changed php file in here (please rename it back from .txt to .php) - we marked everything with "// changed by byteKultur"

thanks again for your help

all the best!

file that we changed
/administrator/components/com_chronoforms/form_actions/csv_export_v2_gh/csv_export_v2_gh.php
GreyHead 27 Sep, 2012
Hi bytekultur,

Just to let you know that I've updated my custom version of this action to include an option to remove the CF & NL characters.

Bob
This topic is locked and no more replies can be posted.