|
|
|
@ -831,23 +831,14 @@ public class CollectController extends Controller {
|
|
|
|
|
if (type_id == 2) {
|
|
|
|
|
String pdfPath = excelPath.replace(".xlsx", ".pdf");
|
|
|
|
|
AsposeUtil.xls2pdf(excelPath, pdfPath);
|
|
|
|
|
HttpServletResponse response = getResponse();
|
|
|
|
|
BufferedInputStream br = new BufferedInputStream(new FileInputStream(pdfPath));
|
|
|
|
|
byte[] buf = new byte[1024];
|
|
|
|
|
int len;
|
|
|
|
|
response.reset(); // 非常重要
|
|
|
|
|
URL u = new URL("file:///" + pdfPath);
|
|
|
|
|
response.setContentType(u.openConnection().getContentType());
|
|
|
|
|
String fileName = pdf_filename;
|
|
|
|
|
response.setHeader("Content-Disposition", "inline; filename=" + fileName);
|
|
|
|
|
OutputStream out = response.getOutputStream();
|
|
|
|
|
while ((len = br.read(buf)) > 0) out.write(buf, 0, len);
|
|
|
|
|
br.close();
|
|
|
|
|
out.close();
|
|
|
|
|
OutputStream outputStream = getResponse().getOutputStream();
|
|
|
|
|
outputStream.write(CommonUtil.convertFileToByteArray(new File(pdfPath)));
|
|
|
|
|
outputStream.flush();
|
|
|
|
|
renderNull();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:学校(单位)查看我该填报或者我已填报的任务列表
|
|
|
|
|
*
|
|
|
|
|