How to solve the line feed problem in cells when PHP generates excel _ PHP Tutorial

Source: Internet
Author: User
PHP solves the line feed problem in cells when generating an excel file. The source code is opened. The line feed method in the string is Name: {$ name} nAddress: {$ adress} nCity: {$ city} nCountry: {$ country} n ...... since n cannot start with a line break, the source code is changed. The line feed method 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, it 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 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.