日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

百万数据报表读取:步骤分析以及自定义事件处理器

發布時間:2024/4/13 编程问答 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 百万数据报表读取:步骤分析以及自定义事件处理器 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

自定義處理器

package cn.learn.poi.entity.cn.learn.poi.handler;import cn.learn.poi.entity.PoiEntity; import org.apache.poi.xssf.eventusermodel.XSSFSheetXMLHandler; import org.apache.poi.xssf.usermodel.XSSFComment;/*** 自定義的事件處理器* 處理每一行數據讀取* 實現接口*/ public class SheetHandler implements XSSFSheetXMLHandler.SheetContentsHandler {private PoiEntity entity;/*** 當開始解析某一行的時候觸發* i:行索引*/@Overridepublic void startRow(int i) {//實例化對象if(i>0) {entity = new PoiEntity();}}/*** 當結束解析某一行的時候觸發* i:行索引*/@Overridepublic void endRow(int i) {//使用對象進行業務操作System.out.println(entity);}/*** 對行中的每一個表格進行處理* cellReference: 單元格名稱* value:數據* xssfComment:批注*/@Overridepublic void cell(String cellReference, String value, XSSFComment xssfComment) {//對對象屬性賦值if(entity != null) {String pix = cellReference.substring(0,1);switch (pix) {case "A":entity.setId(value);break;case "B":entity.setBreast(value);break;case "C":entity.setAdipocytes(value);break;case "D":entity.setNegative(value);break;case "E":entity.setStaining(value);break;case "F":entity.setSupportive(value);break;default:break;}}} } package cn.learn.poi.entity;public class PoiEntity {private String id;private String breast;private String adipocytes;private String negative;private String staining;private String supportive;public String getId() {return id;}public void setId(String id) {this.id = id;}public String getBreast() {return breast;}public void setBreast(String breast) {this.breast = breast;}public String getAdipocytes() {return adipocytes;}public void setAdipocytes(String adipocytes) {this.adipocytes = adipocytes;}public String getNegative() {return negative;}public void setNegative(String negative) {this.negative = negative;}public String getStaining() {return staining;}public void setStaining(String staining) {this.staining = staining;}public String getSupportive() {return supportive;}public void setSupportive(String supportive) {this.supportive = supportive;}@Overridepublic String toString() {return "PoiEntity{" +"id='" + id + '\'' +", breast='" + breast + '\'' +", adipocytes='" + adipocytes + '\'' +", negative='" + negative + '\'' +", staining='" + staining + '\'' +", supportive='" + supportive + '\'' +'}';} }

?

總結

以上是生活随笔為你收集整理的百万数据报表读取:步骤分析以及自定义事件处理器的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。