简体   繁体   English

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

[英]Export Excel 2010 in JavaScript using Apache POI library

I already have a java application which exports some data into an Excel 2003 dataformat and I would like to get it exported into Excel 2010 by using org.apache.poi library .我已经有一个 java 应用程序,它可以将一些数据导出为Excel 2003数据格式,我想通过使用 org.apache.poi 库将其导出到Excel 2010 中 Is it possible to do it using java?可以用java来做吗?

An example from the apache poi site.来自 apache poi 站点的示例
Creating the workbook创建工作簿

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

Saving the workbook as a .xls or the new .xlsx将工作簿另存为 .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();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM