Reputation: 1
I am usng VTL to output a CSV file from Cameo to be read into Excel. In order to output multiple lines into the same Excel cell, I need to insert a Line Feed (LF) character. I have read that I should use #set ($lineFeed = "\n") Line1 ${lineFeed} Line2
to get
Line1 Line2
in a single Excel cell.
Using the sample code simply outputs "\n", i.e.,
Line1 \n Line2
I also tried an interim variable: #set ($lineFeed = "\n") #set ($lf = ${lineFeed}) Line1 $lf $Line2
which similarly imports to Excel as: Line1 \n Line2 I assume the "\n" is for HTML output but not for straight ASCII like CSV files. Is there a way for VTL to output the LF ASCII character?
Upvotes: 0
Views: 43
Reputation: 4150
I would do:
#set($LF = "
")
## On Windows, this will produce <CR><LF> whereas we just want <LF>
#if( $LF.length() == 2 )
#set( $LF = $LF.substring(1, 2) )
#end
Line 1${LF}Line 2
[Edited to cover Windows OS]
Upvotes: 0