java excel交互

我正在尝试在java中创buildExcel文件。 现在,我使用Apache POI库来创build文件并将其保存到本地驱动器。 有没有办法启动Excel和填充数据,而不保存到硬盘驱动器?

也许这样的东西

import java.awt.Desktop; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook; public class ManualXlsxTest { public static void main(String[] args) throws FileNotFoundException, IOException { Workbook wb = new XSSFWorkbook(); wb.createSheet("new sheet"); File tempXlsx = File.createTempFile("temp", ".xlsx"); wb.write(new FileOutputStream(tempXlsx)); Desktop.getDesktop().open(tempXlsx); } } 

考虑使用servlet从服务器下载Excel文件中显示的方法。 我已经使用它的CSV文件,但xlsx MIMEtypes扩展看起来很有吸引力。