我已经编写了用于编写xlsm(Excel 2007)文件的Java文件。
使用Apache POI库,编写xlsx文件是成功的。并且编写xlsm文件也是成功的。但是,当我尝试打开xlsm文件时出现错误,无法打开该文件。
在使用Apache POI库编写xlsm文件是否可行?
如果可以编写xlsm文件,请提供指南如何使用Apache poi库编写xlsm文件。
使用Apache POI库,编写xlsx文件是成功的。并且编写xlsm文件也是成功的。但是,当我尝试打开xlsm文件时出现错误,无法打开该文件。
在使用Apache POI库编写xlsm文件是否可行?
如果可以编写xlsm文件,请提供指南如何使用Apache poi库编写xlsm文件。
XSSFWorkbook workBook = new XSSFWorkbook();
XSSFSheet sheet = workBook.createSheet("Related_SRC");
String realName = "Test.xlsm";
File file = new File("C:\\sdpApp", realName);
try {
FileOutputStream fileOutput = new FileOutputStream(file);
workBook.write(fileOutput);
fileOutput.close();
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
谢谢