Newline characters in cells of written workbooks
See original GitHub issueWhen values v
of cells contain unix line endings \n
they do not become line breaks in the corresponding cells of the written workbook. However, when the Windows carriage return newline combos \r\n
are used Excel appears to properly break the lines when a cell containing them is double clicked (edited).
So there appear to be two things to potentially address here:
- Unix line endings
\n
do not become new lines at all in the written file - Windows line endings
\r\n
only become newlines in Excel when the cell is edited. This may be a shortfall in Excel for Mac 2011 and may not apply to the Windows version.
Issue Analytics
- State:
- Created 9 years ago
- Comments:15 (7 by maintainers)
Top Results From Across the Web
Add Find and Replace Line Breaks in Excel - Contextures
On the keyboard, press Ctrl + J to enter the line break character. NOTE: Nothing will appear in the Find What box. Click...
Read more >Start new line in Excel cell - 3 ways to add carriage return
Three ways to insert a line break in Excel cell: enter multiple lines ... CHAR(10) adds a carriage return between each combined text...
Read more >get a line break / new line in excel file with r xlsx - Stack Overflow
Apply it to the cell: setCellStyle(cell_b_2, cs). Save the workbook: saveWorkbook(wb, 'df.xlsx'). The resulting workbook looks like this:.
Read more >How to Insert Line Break in Excel (Quick and Easy)
Using Define Name Instead of Char(10) · Click the Formulas tab · Click on the 'Define Name' option. Insert Line Break in Excel...
Read more >Quick Tip: Find and Replace Line Breaks in Cells
To show text on separate lines in an Excel worksheet cell, use a shortcut, Alt+Enter, to add a line break. If you want...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Did someone find a workaround? We the same issue on Excel macOS and Excel Windows – text is shown in a single line and changes on double click.
Apple Numbers shows the file correctly.
I could only get this working correctly using the Pro edition where the saving of cell styles is supported. It needed:
\n
in the string value,bookSST: true, cellStyles: true
inXLSX.write
, andcell.s = { alignment: { wrapText: true } }
in the cell style.