Adding a line break using keyword


(Nick Papadatos) #1

Matrix Version: 5.3

Hi talented squiz folk

I have an Asset Listing page with a design => content_type=“text/csv”
Content type - form submission

In the default format I have %question_answer_1706218_q8^replace:,: % . . .
I’m trying to get something similar to a " \n" - linebreak

My aim is to do the following within each cell

From this:
text1,text2,text3,text4

To this:
text1
text2
text3
text4

Thanks
N


(Bart Banda) #2

I think you can do it with the replace keyword modifier and add a regex new line break? Using " \r\n" directly in the keyword modifier or using it via a regex asset.

Then you just have to wrap those in quotes apparently to preserve the new lines according to https://stackoverflow.com/questions/566052/can-you-encode-cr-lf-in-into-csv-files


(Nick Papadatos) #3

Thanks Bart

I tried using:

%question_answer_1706218_q8^replace:(,\r\n):%,%question_answer_1707462_q4%

The above kind of works but places data in odd columns across the spreadsheet. What did you have in mind?
Regards
N


(Bart Banda) #4

Did you try wrapping that in quotes?

"%question_answer_1706218_q8^replace:(,\r\n):%,%question_answer_1707462_q4%"

(Nick Papadatos) #5

Thanks Bart,
That didn’t work either, it’s no big deal really I just thought Matrix was able to add a line break. The client can right click on the cell/column > format cells > Text control: wrap text

Cheers
Nick