We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Csv Export use CRLF instead of LF

Is there a way to get the CSV export in the react grid to use CRLF (\r) instead of just (LF) for new lines


9 Replies

VB Vinitha Balasubramanian Syncfusion Team November 17, 2022 05:16 PM UTC

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



VB Vinitha Balasubramanian Syncfusion Team November 18, 2022 01:33 PM UTC

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



JD Jonathan De Wet November 21, 2022 12:13 AM UTC

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?





PS Pavithra Subramaniyam Syncfusion Team November 22, 2022 12:13 PM UTC

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.


  1. Are you using any Localization in your sample?
  2. If yes, please share the code example.




JD Jonathan De Wet November 22, 2022 09:08 PM UTC

Hi Pavithra,


We are not using any localization



JD Jonathan De Wet November 23, 2022 08:53 PM UTC

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. 




VB Vinitha Balasubramanian Syncfusion Team November 25, 2022 12:29 PM UTC

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.



VB Vinitha Balasubramanian Syncfusion Team December 7, 2022 11:29 AM UTC

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.



VB Vinitha Balasubramanian Syncfusion Team December 13, 2022 12:53 PM UTC

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.



Loader.
Live Chat Icon For mobile
Up arrow icon