How to solve the line feed problem in cells when PHP generates an excel file

Source: Internet
Author: User
The customer asked a question today that the cell line of the exported excel file does not have a line break. The solution is found by searching for resources.

The customer asked a question today that the cell line of the exported excel file does not have a line break. The solution is found by searching for resources.

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.
I read the excel Code generated. Oh My Lady gaga, it was originally in html format, but the file suffix was written as xls. Since the html format and website space should be
You can use a line feed.
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 the word. Oh My Lady gaga, why is there border ????
What is the problem ?? Use \ n, \ r \ n to indicate that a newline cannot be entered. Use
The effect is achieved, but there are new problems... How is it good?
No. use BAIDU google.
Finally, Huang Tian lost his mind and found the answer to the question.
In

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.