如題,用poi生成excel后如何輸出一個file,不用輸出到本地,只要輸入成一個file
我想到的只有先workbook.write()寫到本地,然后再從本地讀獲取file
還有其他更好的方法嗎
uj5u.com熱心網友回復:
沒人知道么,頂一下uj5u.com熱心網友回復:
沒看懂 - -uj5u.com熱心網友回復:
https://www.cnblogs.com/mengyi/p/8426645.htmluj5u.com熱心網友回復:
你可以在運行程式那里建一個臨時檔案夾,把file寫到那里,回傳一個檔案的地址,隨便那里都可以用uj5u.com熱心網友回復:
使用檔案流- - -uj5u.com熱心網友回復:
用流就行了,干嘛要保存到本地啊
..............
Workbook wb = null;
OutputStream os = response.getOutputStream();
response.reset();
response.setHeader("Content-disposition",
"attachment; filename=" + new String(fileName.getBytes("UTF-8"), "ISO-8859-1") + type);
response.setContentType(file.getContentType());
wb.write(os);
...............
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/31092.html
標籤:Java EE
