whycxzp
2023-02-23 e26b3384c6c401ba80bacc6b08202a96cebfa900
src/main/java/com/whyc/util/ExcelUtil.java
@@ -6,6 +6,7 @@
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
/**
 * @Description: 表格工具类
@@ -78,8 +79,8 @@
            e.printStackTrace();
        }
        try {
            //response.setCharacterEncoding("UTF-8");
            response.setHeader("Content-Disposition", "attachment;filename=" + new String(fileName.getBytes(),"ISO8859-1") + ".xls");
            response.setHeader("Content-Disposition", "attachment;filename=" + new String(fileName.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1) + ".xls");
            response.setCharacterEncoding("UTF-8");
            //不保存缓存信息与response.reset同样效果
            response.addHeader("Pragma", "no-cache");
            response.addHeader("Cache-Control", "no-cache");