敏感及重要用户功能
This commit is contained in:
@@ -74,6 +74,24 @@ public class ExcelUtil {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理好的表格直接下载
|
||||
*
|
||||
* @param fileName 文件名
|
||||
*/
|
||||
public static void exportExcelByWorkbook(String fileName, Workbook workbook) {
|
||||
HttpServletResponse response = HttpServletUtil.getResponse();
|
||||
try (ServletOutputStream outputStream = response.getOutputStream()) {
|
||||
fileName = URLEncoder.encode(fileName, CharsetUtil.UTF_8);
|
||||
response.reset();
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
|
||||
response.setContentType("application/octet-stream;charset=UTF-8");
|
||||
workbook.write(outputStream);
|
||||
} catch (IOException e) {
|
||||
log.error(">>> 导出数据异常:{}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定名称、数据下载报表(带指定标题将*显示比必填信息)
|
||||
*
|
||||
@@ -203,7 +221,6 @@ public class ExcelUtil {
|
||||
* @param strings 下拉内容
|
||||
*/
|
||||
public static void selectList(Workbook workbook, int firstCol, int lastCol, String[] strings) {
|
||||
|
||||
Sheet sheet = workbook.getSheetAt(0);
|
||||
// 生成下拉列表
|
||||
// 只对(x,x)单元格有效
|
||||
@@ -218,5 +235,4 @@ public class ExcelUtil {
|
||||
sheet.addValidationData(validation);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user