jQuery in Action, 2nd edition*
The moose likes Java in General and the fly likes how to write comma in CSV file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "how to write comma in CSV file" Watch "how to write comma in CSV file" New topic
Author

how to write comma in CSV file

Raza Mohd
Ranch Hand

Joined: Jan 20, 2010
Posts: 247

i changed the constructor



Good luck!!
A small leak can sink a Gigantic ship.>
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
I'll bet dollars to donuts that you still have no idea what in CSVWriter's terminology "escape characters" and "quote characters" are; otherwise you wouldn't be passing seemingly random values for those to the constructor.

Tell us this: why are you not using the constructor that takes nothing but the Writer as parameter? That's the one you should be using.
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3720
    
  16
Lester Burnham wrote:I give up.


It's worse than trying to give up smoking.
One more post can't do any harm. I'll stop again tomorrow. Honest.


Joanne
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
One more post can't do any harm.

One likes to think so. It may even do some good, in due course. Hope springs eternal.
Raza Mohd
Ranch Hand

Joined: Jan 20, 2010
Posts: 247

but i told you that it gives me Quotes when i open it in notepad if i use only writer as parameter

Thats the problem i have.

Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
Yes, you did say that. And I replied "Of course there are quotes - that's how CSV works". If the individual cell entries contain commas, then those entries must be quoted. Why do you think that's a problem?

If you're still not sure how CSV works, I suggest to create an example file in Excel -having cells that contain both double quotes and commas- and to save that as a CSV. If you then open it in Notepad and study how the cell contents have (and have not) changed, you will get an understanding of CSV (which apparently so far you have not).
Raza Mohd
Ranch Hand

Joined: Jan 20, 2010
Posts: 247

thanks dear..
actually in the need of fulfillment of client request .
I forgot it.

And also there is no tutorial about constructor.
I really did not understand how the NO_QUOTE_CHAR works.
can you tell me where can i find tutorials on that.

Thanks
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
Does that mean that the problem is now solved? Or are you saying that the client requires that there be no double quotes around entries, despite them containing commas? If the latter, then that's impossible, and you need to educate the client on how CSV works.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to write comma in CSV file