怎么在java中将oracle数据导入Excel

你们都给的英文,我一菜鸟怎么看的懂
。。。。。
最好是给我写一下,优先给分
或者可以给我一个文档,JDK1.6不要我有

菜鸟也不怕,干it的会在百度里找到相对应的答案就可以。我指的是菜鸟阶段。我也是菜鸟。呵呵。
1,用jdbc或hibernate把数据读出来,这个是一定的。
2,操作excel主要可以用jxl这个jar包,导进去。用这个包的时候,几个主要的操作,
try {
//open file.
WritableWorkbook book = Workbook.createWorkbook(new File("d:/Test.xls"));

//create Sheet named "Sheet_1". 0 means this is 1st page.
WritableSheet sheet = book.createSheet("Sheet_1", 0);

//define cell column and row in Label Constructor, and cell content write "test".
//cell is 1st-Column,1st-Row. value is "test".
Label label = new Label(0, 0, "test");
//add defined cell above to sheet instance.
sheet.addCell(label);

//create cell using add numeric. WARN:necessarily use integrated package-path, otherwise will be throws path-error.
//cell is 2nd-Column, 1st-Row. value is 789.123.
jxl.write.Number number = new jxl.write.Number(1, 0, 789.123);
//add defined cell above to sheet instance.
sheet.addCell(number);

//add defined all cell above to case.
book.write();
//close file case.
book.close();
相关的操作,网上有好多。去搜一下。
温馨提示:答案为网友推荐,仅供参考
第1个回答  2009-07-24
有很多种方法。

1) Java Excel API
2) open office java API , import oracle data into calc then export as Excel.
3) JDBC to txt or html file, then to excel.
4) maybe java report tool can do it

http://jexcelapi.sourceforge.net/
http://api.openoffice.org

参考资料:http://jexcelapi.sourceforge.net/

第2个回答  2009-07-24
Jakata Poi HSSF开源的包

先用JDBS把数据读出来,然后用POI写到xls文件里面去。

这个是我在百科里面发布的关于怎么用POI来读取EXCELl文档的例子
你只要能把他读取到一个集合里面然后怎么放到数据库里面就不需要人说了吧。
内容我就不贴了,自己看

http://poi.apache.org/spreadsheet/index.html

参考资料:http://baike.baidu.com/view/517279.htm

相似回答