开发者

Generate CSV file

开发者 https://www.devze.com 2023-03-11 11:42 出处:网络
Can someone point me to some good tutorials开发者_StackOverflow中文版 for generating a resultset into a CSV or even Excel file?

Can someone point me to some good tutorials开发者_StackOverflow中文版 for generating a resultset into a CSV or even Excel file?

I'm using j2ee, with Spring and Hibernate.


Here is a utility that does CSV reading and writing:

http://opencsv.sourceforge.net/


can someone point me to some good tutorials for generating a resultset into a csv

It's extremely straightforward to roll your own — just make sure to use StringBuilder or Joiner. Or, use a library.

or even excel file.

You'll want to use Apache POI for that.


Use opencsv 2.2.jar

http://opencsv.sourceforge.net/

CSVWriter writer = new CSVWriter(new FileWriter("yourfile.csv"), '\t'); // feed in your array (or convert your data to an array) String[] entries = "first#second#third".split("#"); writer.writeNext(entries); writer.close();

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号