1:引入jia包:在pom.xml中引入一下jia包:
cn.afterturn
easypoi-base
4.1.0
cn.afterturn
easypoi-web
4.1.0
cn.afterturn
easypoi-annotation
4.1.0
2:**如下:
**(一):controller請求
/**
* 匯出資料
** @param workorderquery
* @param modelmap
* @param response
* @param request
*/public void exportworkorder(workorderquery workorderquery, modelmap modelmap, httpservletresponse response, httpservletrequest request)
**二:介面
void exportworkorder(workorderquery workorderquery , modelmap modelmap, httpservletresponse response, httpservletrequest request);
**三:實現類:匯出,只要引入上面的jia包。所有的功能都在裡面,直接使用即可。
@override
public void exportworkorder(workorderquery workorderquery, modelmap modelmap, httpservletresponse response, httpservletrequest request)
匯出的字段實體:
public class workorderexceldto implements serializable )
private integer workordertype;
@excel(name = "工單狀態", width = 15, replace = )
private integer status;
@excel(name = "所屬技能組", width = 15)
private string groupname;
@excel(name = "負責人", width = 15)
private string responsibleperson;
@excel(name = "建立人", width = 15)
private string createname;
@excel(name = "**商家", width = 15)
private string othername;
@excel(name = "使用者手機號", width = 15)
private string mobile;
@excel(name = "收貨人姓名", width = 15)
private string name;
@excel(name = "收貨人手機號", width = 15)
private string phone;
@excel(name = "收貨人位址", width = 15)
private string address;
}
easypoi 模版匯出
引入包 cn.afterturn groupid easypoi base artifactid 3.2.0 version dependency 在專案目錄新增所要匯出的模版檔案 模版中使用easypoi 提供的模版指令 模板是處理複雜excel的簡單方法,複雜的excel樣式,可以用excel直...
關於EasyPoi匯出Excel
當然了,萬變不離其宗。easypoi的底層原理還是poi。正如mybatis plus的原理還是mybatis那套。只不過它們的共同點是封裝起來。關於easypoi記得初次接觸的時候,給我的感覺是看起來很簡單很容易讓人理解,而且文件也比較豐富,也是jeecg的開源專案下的子專案。記得當初為了提高 開...
使用EasyPoi匯出Excel
excel模板來自自己寫死的乙個excel模板,相當於是使用者查詢資料,資料填充到乙個模板的excel裡,再匯出excel 建立模板 string a request.getsession getservletcontext getrealpath resource 河南能源化工集團安全監控系統聯網...