我使用 POI 将报告写入 excel。这是我的代码:
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("Export To Excel");
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment; filename=avt.xls");
HSSFRow row = sheet.createRow(0);
HSSFCell cell = row.createCell(0);
cell.setCellValue("AAAAAAAAAAAAAA");
cell = row.createCell(1);
cell.setCellValue("BBBBB");
// cell.setCellStyle(cellStyle);
FileOutputStream out = new FileOutputStream("avt.xls");
wb.write(out);
out.close(); System.out.println("Excel written successfully..");
当我单击该按钮时,excel 弹出窗口会打开并显示一条警告消息,但不会将任何内容写入 excel。我也没有在编译器中看到任何错误。怎么了>?