JAVA操作Excel具体代码

请各位高手指点:
用java 操作Excel的具体代码 给一份!
如果需要jar包,请给我一个相关的下载网址~
谢谢~

你需要的东西叫POI,它的官网是:http://poi.apache.org/
你可以下载源文件包(src),里面有快速开发想到,里面有很多使用的例子。使用的时候可以下载二进制包(bin)。

其中的一个例子:
Workbook wb = new HSSFWorkbook();
Sheet sheet = wb.createSheet("new sheet");
Row row = sheet.createRow((short)2);
row.createCell(0).setCellValue(1.1);
row.createCell(1).setCellValue(new Date());
row.createCell(2).setCellValue(Calendar.getInstance());
row.createCell(3).setCellValue("a string");
row.createCell(4).setCellValue(true);
row.createCell(5).setCellType(HSSFCell.CELL_TYPE_ERROR);

// Write the output to a file
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
wb.write(fileOut);
fileOut.close();
温馨提示:答案为网友推荐,仅供参考
第1个回答  2009-02-26
jxl也可以!
poi更全,更复杂!
第2个回答  2009-02-26
受教
第3个回答  2009-02-26
POI
相似回答