java使用poi導(dǎo)出excel工具類 Java利用poi導(dǎo)出excel表格,如何在導(dǎo)出時(shí)自由選擇路徑?
Java利用poi導(dǎo)出excel表格,如何在導(dǎo)出時(shí)自由選擇路徑?導(dǎo)出時(shí)自由路徑選擇的代碼如下:1。后臺(tái)輸出excel文件代碼:OutputStream output=響應(yīng).getOutputStrea
Java利用poi導(dǎo)出excel表格,如何在導(dǎo)出時(shí)自由選擇路徑?
導(dǎo)出時(shí)自由路徑選擇的代碼如下:
1。后臺(tái)輸出excel文件代碼:OutputStream output=響應(yīng).getOutputStream() 響應(yīng).重置() 響應(yīng).setHeader(“Content disposition”,“attachment filename=”路徑)response.setContentType(”內(nèi)容-類型:application/vnd.ms-excel") wb.寫入(輸出)輸出.關(guān)閉()
2. 前端代碼:窗口打開(“getExcelList”,“uBlank”)導(dǎo)出Excel數(shù)據(jù)*@param ID*@param m*@return*/@requestmapping(”/exportexcel”)公共void exportexcel(@requestparam(“ID”)整數(shù)ID,型號(hào)m,HttpServletRequest req,httpservletresponse RESP){嘗試{exportexcel}