my dog learned polymorphism*
The moose likes Other Open Source Projects and the fly likes create csv file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "create csv file" Watch "create csv file" New topic
Author

create csv file

vipin jain
Ranch Hand

Joined: Aug 24, 2008
Posts: 122
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.


Best Regards,<br />Vipin<br />MCA, SCJP5, SCWCD in progress
Omar Al Kababji
Ranch Hand

Joined: Jan 13, 2009
Posts: 357
CSV is simple Coma Seperated Value file you could simple use a PrintWriter to create a file and give it an extension of .csv


Omar Al Kababji - Electrical & Computer Engineer
[SCJP - 90% - Story] [SCWCD - 94% - Story] [SCBCD - 80% - Story] | My Blog
vipin jain
Ranch Hand

Joined: Aug 24, 2008
Posts: 122
hi ,
thanks for reply but i alsio want to add image inside csv file.....
Omar Al Kababji
Ranch Hand

Joined: Jan 13, 2009
Posts: 357
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
Marshal

Joined: Mar 22, 2005
Posts: 42365
    
  64
... 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.


Ping & DNS - my free Android networking tools app
vipin jain
Ranch Hand

Joined: Aug 24, 2008
Posts: 122
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

Joined: Sep 11, 2006
Posts: 959

Apache POI


SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
Uli Hofstoetter
Ranch Hand

Joined: Nov 24, 2006
Posts: 57
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


SCEA5, Certified ScrumMaster
 
Consider Paul's rocket mass heater.
 
subject: create csv file