aspose file tools*
The moose likes Java in General and the fly likes Write comma with CSVWriter + help needed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Write comma with CSVWriter + help needed" Watch "Write comma with CSVWriter + help needed" New topic
Author

Write comma with CSVWriter + help needed

Raza Mohd
Ranch Hand

Joined: Jan 20, 2010
Posts: 247

can anybody give me solution that i want my CSV file with no Quote character.

and i using Final field NO_QUOTE_CHAR

and i want to write a field which is having Comma in it.

for example ::

cvv number ('Q','C')
card number
Id



please help me..

i stuck for a long time.


Good luck!!
A small leak can sink a Gigantic ship.>
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4366
    
    8

What output are you getting from that code?
Raza Mohd
Ranch Hand

Joined: Jan 20, 2010
Posts: 247

thanks for reply:


cvv number ('Q','C')

underlined field is splitted in two shells when i open it in excel because of comma .

i want it to be in a single field.



Raza Mohd
Ranch Hand

Joined: Jan 20, 2010
Posts: 247

output split the field into two.
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4366
    
    8

I'm probably missing something...but isn't that what the quote characters are supposed to solve? If you put the entire field in double-quotes then Excel will treat it as one field. It looks to me like you've deliberately turned off the feature that will help you.
Raza Mohd
Ranch Hand

Joined: Jan 20, 2010
Posts: 247

so what should i do?
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4366
    
    8

Well, can you not try:
or
?
Raza Mohd
Ranch Hand

Joined: Jan 20, 2010
Posts: 247

actually if i use these..

i get Quotes when i open it in wordpad and that is not desired.

can somebody solve that issue for me.

Thanks
Raza!
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4530
    
    5

You appear to have two conflicting requirements. Like it or not, you'll have to drop one or the other.


luck, db
There are no new questions, but there may be new answers.
Raza Mohd
Ranch Hand

Joined: Jan 20, 2010
Posts: 247

is there any conndition that using NO_QUOTE_CHAR i can make one field to write irrespective of comma.

or i can escape comma for only one field?


Thanks Raza!
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4366
    
    8

Quotes are the mechanism that CSV files use to cope with commas - I don't think Excel is going to understand anything else. If you really can't have them, I think your only other option would be to remove the comma first - replace it with a different character.
Raza Mohd
Ranch Hand

Joined: Jan 20, 2010
Posts: 247

i can not replace it.

as the files to be generated with the same format only.

with the DEFAULT_QUOTE_CHAR excel is fine but when i open in notepad it gives entries surrounded with Quotes.That should not be there because the client do not want it.




Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4366
    
    8

I think you're going to have to explain to the client that Excel and Notepad work in fundamentally different ways, and the file cannot be generated so that it behaves the way they want in both of them. They're going to have to choose.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Write comma with CSVWriter + help needed