EasyExcel的讀寫使用

2021-10-11 18:55:37 字數 828 閱讀 1581

1.先根據excel建立對應實體類,一列對應乙個屬性:

@data

public

class

easyexcelentity

2.寫service業務**:

public

class

easyexcelwritedemo

public

static list

dodata()

return list;

}}

1.寫實體類(如上)

2.寫監聽類

public

class

excellistener

extends

analysiseventlistener

//讀取表頭

public

void

invokeheadmap

(map

headmap, analysiscontext context)

//讀完之後做的操作

@override

public

void

doafterallanalysed

(analysiscontext analysiscontext)

}

3.讀操作業務**

@test

public

static

void

main

(string[

] args)

EasyExcel讀寫操作

com.alibaba easyexcel 2.1.1 org.apache.poi poi3.1.7 org.apache.poi poi ooxml 3.1.7 注意版本對應 data allargsconstructor noargsconstructor tostring public cl...

EasyExcel讀寫操作

com.alibaba easyexcel 2.1.1 org.apache.poi poi3.1.7 org.apache.poi poi ooxml 3.1.7 注意版本對應 data allargsconstructor noargsconstructor tostring public cl...

EasyExcel的讀寫操作

1 引入依賴 easyexcel需要用到poi的依賴,2.1 1對應3.17,否則容易出錯 xls org.apache.poi groupid poi artifactid 3.17 version dependency xlsx org.apache.poi groupid poi ooxml ...