Using PHP to extract data from SQL and then creating a .csv file on the server for emailing/download by way of fputcsv. All works well other than trying to get a new line within a field in Excel (2003).
I get Product1Product2Product3 in the cell when I need
Product1
Product2
Product3
I have tried single quotes, double quotes, CRs, LFs and I am rapidly disapearing up my own backside.
So the question is - what character do I need to get into the CSV file to achieve this?
It has to work in Excel
[Solution] - the problem lay somewhere in passing the
to Excel through the PHP fputcsv - I was unable to achieve this in any sort of fashion (plenty of appending the desired
to my actual cell data e.g. Product1
)
The suggestion to use $lfcr = chr(10) . chr(13); worked first time around. I guess this was more of a PHP rather than an Excel question - thanks to all resonses.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…