|
@@ -66,6 +66,7 @@ import java.util.*;
|
|
|
import java.util.regex.Matcher;
|
|
|
import java.util.regex.Pattern;
|
|
|
import java.util.stream.Collectors;
|
|
|
+import org.springframework.http.ContentDisposition;
|
|
|
|
|
|
@RestController
|
|
|
@AllArgsConstructor
|
|
@@ -366,8 +367,12 @@ public class WbsTreeContractController extends BladeController {
|
|
|
//返回响应
|
|
|
try (ServletOutputStream outputStream = response.getOutputStream();
|
|
|
ByteArrayOutputStream byteArrayOutputStreamResult = new ByteArrayOutputStream()) {
|
|
|
+ //文件编码处理
|
|
|
+ String encode = URLEncoder.encode(fileName, "UTF-8");
|
|
|
+ encode = encode.replaceAll( "\\+", " ");
|
|
|
+ encode = encode.replaceAll( "%2B", "+");
|
|
|
//设置响应头
|
|
|
- response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(fileName, "UTF-8") + ".xlsx");
|
|
|
+ response.setHeader("Content-Disposition", "attachment; filename=" + encode + ".xlsx");
|
|
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
|
|
workbook1.write(byteArrayOutputStreamResult);
|
|
|
byte[] excelBytesResult = byteArrayOutputStreamResult.toByteArray();
|