Print new lines into cells of CSV file
P粉276577460
2023-08-22 18:17:10
<p>I am using php to generate a CSV file. I need to print text wrap within a cell (in Excel you can use <kbd>Ctrl</kbd> <kbd>Enter</kbd> or <kbd>Alt</kbd> <kbd>Enter</ kbd>implementation). For this I tried using <code>'n'</code>, <code>'r'</code> but it didn't help. How can I achieve this? </p>
<p>I am using yii extension ECSVExport to generate csv. </p>
<p>The output I want is as follows: </p>
<pre class="brush:php;toolbar:false;">ID Value
1A
B
2C
3E
FF
G
4 X</pre>
<p><br /></p>
Use
or (use variable)"\n"
within the cell value (wrapped with"
) and use"\r\n"
as the end of record tag. If If the cell input contains multiple lines, must be surrounded by ".
or (use fputcsv()
or (using)
fputcsv()
and variables)
Try this
Within double quotes