|
|
@@ -32,7 +32,7 @@ public class ExcelWriteUtil {
|
|
|
* @param titleMap 标题头
|
|
|
* @param list 列表
|
|
|
*/
|
|
|
- public static <T> void writeToResponse(final HttpServletResponse response, final String fileName, final String excelTitle, final Map<String, String> titleMap, final List<T> list, final Class<T> tClass) {
|
|
|
+ public static <T> void writeToResponse(HttpServletResponse response, final String fileName, final String excelTitle, final Map<String, String> titleMap, final List<T> list, final Class<T> tClass) {
|
|
|
try {
|
|
|
@Cleanup ExcelWriter writer = ExcelUtil.getWriter();
|
|
|
//写入标题
|
|
|
@@ -65,6 +65,7 @@ public class ExcelWriteUtil {
|
|
|
i++;
|
|
|
}
|
|
|
//设置响应头
|
|
|
+ response.setContentType("application/octet-stream");
|
|
|
response.setHeader("Content-Disposition", String.format("attachment;filename=%s%s", fileName, ".xls"));
|
|
|
writer.flush(response.getOutputStream(), true);
|
|
|
} catch (Exception e) {
|