Search code examples
c#winformsdevexpressxtragridxtrareport

Currency format without the thousands separator (remove comma in fields in saved reports)


I currently set some of my fields on my data grid with "c2" as the FormatString. When I generate .csv reports with XtraReports by printing on the XtraGrid, the thousands separator is included in the fields formatted as "c2". I don't want to include the comma in the exported .csvs as external systems have trouble importing the data.

What are my options to remove the comma in the fields in the .csv reports?

  • Can I just format the data with a preceding $ sign without the thousands separator in the data grid (and what would the FormatString be for that in this case). However, I do like visually having the separator on the grid, just not the .csv file.

  • Is there some sort of interceptor I can write that will remove commas during report generation?


Solution

  • I suggest that you clear the FormatString property before exporting the grid and revert this property value back when the exporting result is ready. This looks to be the easiest solution to this problem.