我用的是springMVC框架,要實(shí)現(xiàn)下載功能,可是我只能把數(shù)據(jù)寫入excel中,ByteArrayOutputStream os;os = new ByteArrayOutputStream();workbook.write(os);//workbook為寫好了的HSSFWorkbookreturn os.toByteArray();這樣寫是對(duì)的嗎,在前臺(tái):byte[] buff = null;//buff為后臺(tái)返回的值response.setCharacterEncoding("UTF-8");response.setContentType("application/vnd.ms-excel");zresponse.addHeader("Content-Disposition", "attachment; filename=\""+filename+"\"");OutputStream out = response.getOutputStream();out.write(buff);out.flush();這樣寫有問(wèn)題嗎,我的需求是下載完成后能在彈出的dialog中找到下載的文件的位置,服務(wù)器上不需要存儲(chǔ)。我看你的代碼實(shí)現(xiàn)在點(diǎn)擊導(dǎo)入模板后就直接彈出來(lái)了,可是我始終實(shí)現(xiàn)不了,還望不離賜教
excel下載問(wèn)題
半島陽(yáng)光0
2016-03-20 21:07:57