研究的不深,先贴代码,日后再说。
@RequestMapping(value = "/form/printContract") public ResponseEntity<byte[]> printContract(ContractIreportForm form)throws Exception { HttpHeaders headers = new HttpHeaders(); //声明变量 File file = null ; try { file = new File(""); String downFileName = new String(("").getBytes("UTF-8"),"iso-8859-1"); headers.setContentDispositionFormData("attachment", downFileName); headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); form.setIsSuccess(SUCCESS); } catch (Exception e) { form.setIsSuccess(FAILURE); form.setMsg(exMsg(e)); } return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file), headers, HttpStatus.CREATED); }
时间: 2024-11-29 02:39:11