-
Notifications
You must be signed in to change notification settings - Fork 362
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
Preserve new lines in cells with option preserveNewLinesInCells (#91) #171
Conversation
…rco#91) \n and \r are converted to \u2028 and \u2029 in order to pass through JSON.stringify, then converted back to \n and \r. Note any original \u2028 and \u2029 are converted to \n and \r.
My attempt to fix #91. I preferred to use an option to prevent any side effect with Excel users, but it worked for me with Excel on Windows and OSX. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just a couple minor tweaks.
README.md
Outdated
@@ -46,6 +46,7 @@ try { | |||
- Supports optional custom quotation marks | |||
- Not create CSV column title by passing hasCSVColumnTitle: false, into params. | |||
- If field is not exist in object then the field value in CSV will be empty. | |||
- Preserve new lines in cells. Should be used we \r\n line ending for full compatibility with Excel. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo, "should be used with"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"line endings"
README.md
Outdated
@@ -67,6 +68,7 @@ try { | |||
- `unwindPath` - String, creates multiple rows from a single JSON document similar to MongoDB's $unwind | |||
- `excelStrings` - Boolean, converts string data into normalized Excel style data. | |||
- `includeEmptyRows` - Boolean, includes empty rows. Defaults to `false`. | |||
- `preserveNewLinesInCells` - Boolean, preserve \r and \n in cells. Defaults to `false`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cells are Excell specific, let's call this something more generic.
I'm not sure if this should even be an option. Maybe it should be on by default. |
Thanks for the review. I used the term 'value' instead of 'cell', is it fine for you? |
\n and \r are converted to \u2028 and \u2029 in order to pass through
JSON.stringify, then converted back to \n and \r.
Note any original \u2028 and \u2029 are converted to \n and \r.