In the process of data processing today, in the database used a \ n line-break symbol, the purpose is to do in the same table data multi-line display, such as
Field Name 1 |
Field Name 2 |
Field Name 3 |
1 |
Data row Data two rows Data three rows |
The example is the result after the SQL query |
2 |
Example above |
Data not exported |
Originally after the SQL query is so displayed, but later exported text format, Excel from the text import content will be error, then the problem comes,
How to do Excel self-text import content when the cell line wrapping?
Text: On the internet to find a lot of examples, one of the predecessors spoke very reasonable, the following words:
Two essential conditions for Excel to wrap a line
1. Format Excel cells to wrap.
2. Add line break CHAR (10) in the middle of the text
CSV is an ordinary text file that cannot meet the first condition. So the automatic line wrapping function is impossible to implement.
This predecessor of this sentence really let me think carefully, and then according to some examples on the internet, sure enough to let me find a solution:
is to use the SQL string operation to output the above field name 2 under the multiple rows of data as follows:
= "Data row", "Data Two rows", "Data three rows"
After you use Excel to import content from text, the Excel text document displays:
= "Data row", "Data Two rows", "Data three rows"
Finally, the replacement function will be replaced with &char (&), Replaced by = "Data Row" &char (Ten) & "Data two Rows" &char (Ten) & "data three rows" in another cell input = The cell to be wrapped and set it to wrap, and the contents of the cell are what we want.
Cell to Wrap |
The ideal result |
Data row data Two rows of data three rows |
Data row Data two rows Data three rows |
= "Data row" &char & "Data two Rows" &char & "data three rows" |
= Cell to Wrap |
End: May not express well, everyone take a good look at the above table, it should be good to understand the point! Rest, it's not too early.
How Excel can wrap text in cells as it imports content