-
-
Notifications
You must be signed in to change notification settings - Fork 8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Newline characters in cells of written workbooks #108
Comments
Try writing with the shared string table (bookSST:true option when you write). I explored Excel 2011 a bit and found:
You'd think that Excel would use one unified XML parser, but it appears that is not the case :/ The fix here is straightforward, but the question still remains: should the writer handle both types of newline (\n and \r\n)? A literal encoding of both in the shared string table is treated as two newlines, not one, so there is some ambiguity there |
Using booSST:true seemed to work for me when opening xlsx file on Linux and LibreOffice but didn't work on Excel on Win 10. |
@reviewher here is a code example. It works fine with macOS numbers. I didn't test it with LibreOffice yet. But Excel 15.17 under macOS ignores the line breaks at first, but adds them as soon as you double click on the cell. |
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 have the same problem. Did anyone find a workaround? \n and \r\n don't actually break in Excel on Mac at least. |
I could only get this working correctly using the Pro edition where the saving of cell styles is supported. It needed: |
To summarize: merely placing a newline character is insufficient. Excel requires the text wrapping style attribute to be applied to the cell, otherwise it is rendered like a whitespace character. This is a part of our Pro builds. @fozcode I don't believe |
@SheetJSDev I've tested again and you are correct, In LibreOffice a multi-line string is displayed on one line unless you set |
it seems to not be correct tag in xlxs.js file :line 19974 |
@jefleponot Reviewing the spec http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html
You're proposing we create separate paragraphs for each logical line, which is fine but I'm curious why the line break doesn't work |
Could I propose a PR ? Could you accept it ? |
@SheetJSDev is there a solution for the community edition? |
same issue |
Anybody ever found a solution for community edition? We can not access the pro edition because we have not received replies yet when we reach out... |
Why is something as simple as a newline behind a paywall (Pro)? |
Same issue |
😞 |
Add more VBA Code to resolve this |
When 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:
\n
do not become new lines at all in the written file\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.The text was updated successfully, but these errors were encountered: