通過模板實現POI

bug窩發表於2020-12-09

部分程式碼

未完待補充

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;
在這裡插入圖片描述
佛祖標記

相關文章