Is there a way to get the CSV export in the react grid to use CRLF (\r) instead of just (LF) for new lines
Hi Jonathan,
Greetings from Syncfusion support
Currently, we are validating your reported problem with your shared information, and we will update you the details shortly. Until then we appreciate your patience.
Regards,
Vinitha Balasubramanian
From your query, we understood that you want to use “CRLF” (\r) instead of using “LF” () on CSV exporting. We have prepared a sample and achieved your requirement by using excelQueryCellInfo event of Grid. Inside this event you can customize the column values as per your requirement. Please refer the below code and sample for your reference.
[index.js] excelQueryCellInfo(args) {
if (args.column.field === 'ShipCity') { var split = args.value.split(' '); var newString = ''; for (var i = 0; i < split.length; i++) { newString += '\r' + split[i]; } args.value = newString; } } |
Sample : https://stackblitz.com/edit/react-x9xweb-cfkfmb?file=index.js
API : https://ej2.syncfusion.com/react/documentation/api/grid/#excelquerycellinfo
Hi Vinitha,
Thanks for your reply. Unfortunately, I think there was a misunderstanding about what I wanted.
Currently, when you click CSV export you get something like this
But I want this
I want to change the line endings of each row of the csv not change the newline format of multiline strings inside a csv
Is there a way to do this?
Hi Jonathan,
To validate further could you please share the below details which will be helpful for us to check the feasibility of your requirement.
Hi Pavithra,
We are not using any localization
Any update on this? I got an email today about an ASP.net control bug that sounded similar. But my problem is with the react component.
We have confirmed and logged this as a bug in the component. So, we have considered ”Modify to \r as line separators in Grid to CSV export” as a defect and logged a report for the same. We will include the defect fix in our upcoming patch release, which is expected to be rolled out on Dec 07th, 2022,.
You can now track the status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.
Feedback link : https://www.syncfusion.com/feedback/39329/modify-n-to-r-n-as-line-separators-in-grid-to-csv-export
Disclaimer: Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.
We are unable to complete the issue (“Modify to \r as line separators in Grid to CSV export”) as planned due to its complexity and currently, we are working on this with high priority. We will include the fix in upcoming weekly patch release.
We appreciate your patience until then.
We are glad to announce that our Essential Javascript2 patch release (20.3.61) has been rolled out successfully and in that release, we have added the fix of “Modify to \r as line separators in Grid to CSV export” issue. So, please update your Syncfusion packages to the current version and use latest style script to get this.
Release Notes: https://ej2.syncfusion.com/react/documentation/release-notes/20.3.61/?type=all
We thank you for your support and appreciate your patience in waiting for this release. Please contact us if you would require further assistance.