使用Apache POI库在JavaScript中导出Excel 2010

时间:2014-09-17 07:51:39

标签: java excel apache-poi

我已经有一个java应用程序将一些数据导出到 Excel 2003 数据格式中,我想通过使用org将其导出到 Excel 2010 。 apache.poi库。是否有可能使用java?

1 个答案:

答案 0 :(得分:1)

来自apache poi网站的example 创建工作簿

//Excel 2003
Workbook wb = new HSSFWorkbook();
//Excel 2010 and upwords
Workbook wb = new XSSFWorkbook();

将工作簿另存为.xls或新的.xlsx

// Write the output to a file
String file = "foo.xls";
if(wb instanceof XSSFWorkbook) file += "x";
FileOutputStream out = new FileOutputStream(file);
wb.write(out);
out.close();