How we can write delimiter like sep=, using CsvHelper library?

user3473830

we're using CsvHelper library to export some information from our application, our clients normally use Excel to see the results

enter image description here (sample of correctly opened data)

everything was working well until I tested my generated files in another machine with Format set on German(Austria) which I found out that excel would not parse it correctly anymore which is understandable because , has a different meaning in this format. enter image description here

adding sep=, in the first line seems to fix the issue, but I couldn't find in CsvHelper documents that How we can achieve this. so the question is

How we can write delimiter like sep=, or anything with similar effect using CsvHelper library?

xanatos

Inside the CsvWriter class there is an aptly named WriteExcelSeparator() that should do it.

Depending on how you use the library, you can even:

csv.Configuration.Delimiter = ",";
csv.Configuration.HasExcelSeparator = true;

If you use the WriteRecords, use the second way, while if you use WriteHeader/WriteRecord use the first one.

csv.WriteExcelSeparator();
csv.WriteHeader<Simple>();
csv.WriteRecord( record );

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Can we write tests in visual studio by using karate library?

How to write a class library in c++ like the one we write for functions

How to write object that contains arrays using csvHelper?

how can we write an unchecked event for checkbox in jquery?. like we do for checked event?

How can we get a layout like this in tkinter using grid?

How can we open CSV files that are using single quotation as string delimiter in Excel?

PHP: How can we explode a string using a single delimiter repeating multiple times?

How can we write a text file from variable using python?

How we can write data to a postgres DB table using R?

How to efficiently write a csv file with thousands of columns using csvhelper?

How can write a query like this using dblink in postgres?

can we write to a word file using c?

Can we upgrade csvhelper.dll

How can I display my created error list using csvhelper

How can we write a unit test for printing?

How can we JOIN two Spark SQL dataframes using a SQL-esque "LIKE" criterion?

In SQL, how can we match using LIKE up to but not exceeding a number of wildcard characters?

How can we get the multiple elements with one expression like using for loop

How can we generate/encode barcode image without border using zxing library in .net code?

How can we version our library built only with headers using CMAKE?

How can we add '.svg' formatted image in pdf using itext library in java/struts2

How to write to a file using comma delimiter and no double quote in string?

How can we write Chunks of data for a Huge List of Custom Objects using ObjectOutputStream

Write to CSV file using CsvHelper in C#

Proper way to write async using CsvHelper

CsvHelper custom delimiter

Why if we have to read/write using SPI we have to do like this?

CsvHelper : How to detect the Delimiter from the given csv file

How to write a CSV file after reading it with CsvHelper?