package com.mes.utils.excel;
|
|
import javax.servlet.http.HttpServletResponse;
|
import java.io.UnsupportedEncodingException;
|
import java.net.URLEncoder;
|
|
/**
|
* @Author : zhoush
|
* @Date: 2025/5/12 17:03
|
* @Description:
|
*/
|
public class ExcelUtil {
|
public static void setExcelResponseProp(HttpServletResponse response, String rawFileName) throws UnsupportedEncodingException {
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
response.setCharacterEncoding("utf-8");
|
String fileName = URLEncoder.encode(rawFileName, "UTF-8").replaceAll("\\+", "%20");
|
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
|
}
|
}
|