我正在使用SpringFramework。我想用Java创建一个excel文件。 下面是我创建excel文件失败的代码。
public void eventsUpdate(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException{
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment; filename=events123.xls");
HSSFWorkbook hwb = new HSSFWorkbook();
HSSFSheet sheet = hwb.createSheet("new sheet");
}