部分代码
未完待补充
HttpHeaders headers=new HttpHeaders();
String name=new String(“yuangongxinxi.xls”.getBytes(“UTF-8”),“ISO8859-1”);
headers.setContentDispositionFormData(“attachment”, name);
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
ByteArrayOutputStream outputStream=new ByteArrayOutputStream();
wb.write(outputStream);
byte[] bytes=outputStream.toByteArray();
//核心构造器,1,下载参数2,头文件,3,响应状态信息
ResponseEntity<byte[]> entity=new ResponseEntity<byte[]>(bytes,headers, HttpStatus.OK);
wb.close();
return entity;
佛祖标记