Retain linebreaks into one cell when exporting to excel.

Retain linebreaks into one cell when exporting to excel.

mesqueebmesqueeb Posts: 38Questions: 12Answers: 1

Dear community,
I'm stuck on this problem. And I've asked it on stackoverflow as well:

http://stackoverflow.com/questions/35761577/export-value-with-linebreaks-into-single-cell-in-excel-with-jquery-datatables-20

It would be great if anyone could help me out!
Best regards!

Answers

  • mesqueebmesqueeb Posts: 38Questions: 12Answers: 1

    The correct answer is:

    data.replace( /<br\s*\/?>/ig, "\n" ) :
    

    However, you need to press the "wrap text" button when opening the excel.
    If someone knows a way to have it wrapped automatically, please let me know.

  • tomboschtombosch Posts: 2Questions: 1Answers: 0

    This solution create a &lt;br&gt; instead of an line break. Any idea how to fix this?

    Thanks!

This discussion has been closed.