• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

create csv file

 
vipin jain
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how we can create csv file in java and write resultset data inside in tabular form as well as image?
please any one reply as soon as possible.
 
Omar Al Kababji
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
CSV is simple Coma Seperated Value file you could simple use a PrintWriter to create a file and give it an extension of .csv
 
vipin jain
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ,
thanks for reply but i alsio want to add image inside csv file.....
 
Omar Al Kababji
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can't put an image in a CSV file, unless you just get the InputStream of the image and read its bytes and store them in the file in some way. and then reconstruct the image in the same way you wrote in the CSV file. however a CSV is used only plain text not for images.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
... so, effectively, you can't keep images inside of CSV files. Would using the XLS file format (used by Excel) be an option? It can accommodate images, and there are Java libraries available that can create them.
 
vipin jain
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Ulf Dittmer ,

Thanks for reply.......
can you please tell me which java library is using for that and if you have that jar please send me.
your every help would be appreciated.
 
Freddy Wong
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apache POI
 
Uli Hofstoetter
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

when it comes to creating excel files, you might want to take a look at jXLS.

jXLS is kind of a templating engine for exel. You create a excel file with tags as a template and jxl populates the template from java beans.

Regards.
Uli
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic