Jfinal之 poi render

xiaoxiao2021-02-28  89

import java.io.IOException; import org.apache.poi.hssf.usermodel.HSSFWorkbook; public class PoiRender extends Render { private HSSFWorkbook wb; private String name; public ExcelRender(HSSFWorkbook wb, String name){ this.wb = wb; this.name = name; } public void render() { response.addHeader("Content-disposition", "attachment; filename=" + name); response.setContentType("application/x-msdownload"); try { wb.write(response.getOutputStream()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
转载请注明原文地址: https://www.6miu.com/read-42190.html

最新回复(0)