Export to a CSV File - Formating Strings

Hi there,

when I export a file to a CSV Format, I got a problem when an cell has a Comma in the data. Is there a property where I can set Coumns to “Text”-Format?

kind regards

Joerg

CSV stands for Comma Separated Values. If your data has a comma in it then the values on either side of the embedded comma become separate values.

Rick

Thanks for explanation. I know that, but you can normally put that into Quotes.
If a comma is in the data the application which will import that file will ignore that comma.

regards
Joerg

Hi Joerg,

I am not clear about your problem. Could you elaborate it?

If a cell has a comma in the text, the result CSV file will add quotes to this string. That’s the routine of CSV format.

> I am not clear about your problem. Could you elaborate it?

In one DataColumn I have data of dbtype nvarchar. Inside this data are commas.

> If a cell has a comma in the text, the result CSV file will add quotes to this
> string. That’s the routine of CSV format.

That should be the way it works…but it doesn’t.
I have to check the datatypes in my DataTable and will try it again.

thanks

Joerg

Do you mean you create a datatable and export the data to an csv file using Aspose.Excel? And you find a string including comma doesn’t work in the result file?

Please try to save the file in excel format and see if it works fine.

> Do you mean you create a datatable and export the data to an csv file using
> Aspose.Excel? And you find a string including comma doesn’t work in the result
> file?

That is exact my problem!

Import to an Excel file work.

regards

Joerg

Hi Joerg,

Could you send me the created CSV file and Excel file with same data? I will check what caused this problem. Thanks.

Sure I will do that.
Right now I#m testing within datatypes and datatable.
ASAP I will create the files.
To which eMail Address you want to have the files?
Any extra subject?

kind regards
Joerg

Please send them to excel@aspose.com.

I will contact you if I need extra information.

Thanks.

hi joerg,

you can surround each field with double quotes

for eg:


“Varun.P, Reubro Intl, Kochin”,“Male”,"26"


I hope it will help u


varun
+919995226779