java Excel未以正确格式导出
我正在尝试使用jsp将数据导出到excel。但它并没有以excel格式正确导出,整个html页面只是被导出。我不知道如何使用ApachePOI。我正在使用下面的代码
response.setHeader("Content-Disposition", "attachment;filename=name.xls");
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet);
# 1 楼答案
检查this教程
您需要使用POI库,然后您可以通过简单的代码将任何数据写入excel文件,如下所示: