The customer asked a question today that the cell line of the exported Excel file does not have a line break.
The source code is opened, and the line feed method used in the string is "Name: {$ name} \ naddress: {$ adress} \ ncity: {$ city} \ ncountry: {$ country} \ n ......"
Since "\ n" cannot start with a line break, change it to "\ r \ n.
Modify = submit = test
There is still no line feed !!!!
Is it a problem with operating system compatibility ??
Directly use the PHP runtime constant php_eol to replace "\ r \ n"
Modify = submit = test
There is still no line feed !!!!
What is the situation? This cannot solve the problem of OS compatibility.
Let's see how the xls file is generated using PHP.
After reading the generated Excel fileCode, Oh my Lady Gaga, originally in HTML format, but the file suffix is written as XLS. Since the HTML format is used, it should be <br/>.
Continue
Modify = submit = test
The result is a line break. Congratulations. The problem is finally solved.
Tell the boss to solve the problem. At this time, I am very happy.
After a quarter of a year, the boss ran and said, "The problem with the line feed effect is solved, but you can see that the data cannot be copied ."
....
N sentences are omitted.
Copy the data of a cell and paste it into word. Oh my Lady Gaga, why is there border ????
What is the problem ?? Use \ n, \ r \ n to indicate that the newline cannot be used. Use <br/> to display the effect, but a new problem occurs... How is it good?
No. use Baidu Google.
Finally Huang Tian don't have heart, in http://nece001.blog.163.com/blog/static/85633602008979136966/ found the answer to the question.
Append the CSS style BR {MSO-data-placement: Same-cell;} to the <style> </styel> label ;}
Finally, the problem is solved perfectly.
Thank you for"The true face of Kakashi"This dear friend shared his knowledge. Otherwise, I don't know when to fix it !!