Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Write comma with CSVWriter + help needed

 
Raza Mohd
Ranch Hand
Posts: 247
Java MyEclipse IDE MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What output are you getting from that code?
 
Raza Mohd
Ranch Hand
Posts: 247
Java MyEclipse IDE MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 247
Java MyEclipse IDE MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
output split the field into two.
 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 247
Java MyEclipse IDE MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so what should i do?
 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, can you not try:
or
?
 
Raza Mohd
Ranch Hand
Posts: 247
Java MyEclipse IDE MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You appear to have two conflicting requirements. Like it or not, you'll have to drop one or the other.
 
Raza Mohd
Ranch Hand
Posts: 247
Java MyEclipse IDE MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 247
Java MyEclipse IDE MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic