簡單的poi匯出

2021-09-09 09:06:23 字數 1306 閱讀 9611

org.apache.poi

poi-ooxml

3.17

org.apache.poi

poi3.17

package com.bw.entity;

public class user

public void setuid(integer uid)

public string getuname()

public void setuname(string uname)

public string getpwd()

public void setpwd(string pwd)

public integer getage()

public void setage(integer age)

@override

public string tostring()

}

在前台頁面傳送請求

匯出
在控制層接收引數

hssfrow row = sheet.createrow(0);// 建立行,從0開始

hssfcell cell = row.createcell(1);// 建立行的單元格,也是從0開始

cell.setcellvalue("id");// 設定單元格內容

hssfcell cell1 = row.createcell(2);// 建立行的單元格,也是從0開始

cell1.setcellvalue("uname");// 設定單元格內容

hssfcell cell2 = row.createcell(3);// 建立行的單元格,也是從0開始

cell2.setcellvalue("age");// 設定單元格內容

for (int i = 0; i < list.size(); i++)

//將excel檔案存入指定資料夾

fileoutputstream out = new fileoutputstream("d:\\images\\abc.xls");

workbook.write(out);// 儲存excel檔案

system.out.println("成功"); }

效果如下圖:

POI的匯入匯出

匯入測試 匯入的模板一定要按照格式準備,固定每列的內容 created by hp on 2018 9 18.public class poiimport 匯出測試 created by hp on 2018 9 18.public class poiexport poi匯入用的是jquery的oc...

Poi簡單實現Excel的匯出匯入功能

最近專案用到了有關excel的匯入匯出功能,之前也沒有使用過,簡單的寫一下基本用法 小白階段有寫錯的還望大神們指教,小弟先謝過了!步驟思想 匯出excel 1.建立乙個工作簿workbook 2.建立乙個sheet 3.建立row 4.為每一行 row 的cell賦值 example string ...

jsp簡單匯出word,不使用poi

組織處理決定表 填寫人 匯出 function datatype json success function data jquery var wordexport new jquery.export responsebody public integer exportdisposetable str...