MyExcel 是一個集導入、導出、加密 Excel 等多項功能的 Java 工具包。
導入:提供簡便的API,讀取Excel內容,並轉化為List< Bean >。
導出:可快速導出海量數據的簡單列表,可生成高複雜度布局的Excel,複雜布局指的是包含多種不規則合併單元格、背景色、字體大小、斜體等。
優點:
本次更新如下:
建議所有使用用戶進行升級,具體使用,請移步:https://github.com/liaochong/myexcel/wik
// 全部讀取后處理
List<ArtCrowd> result = DefaultExcelReader.of(ArtCrowd.class)
.sheet(0) // 如果為0,可省略該操作
.rowFilter(row -> row.getRowNum() > 0) // 如無需過濾,可省略該操作
.read(path.toFile());
// 讀取一行處理一行,可自行決定終止條件
DefaultExcelReader.of(ArtCrowd.class)
.sheet(0) // 如果為0,可省略該操作
.rowFilter(row -> row.getRowNum() > 0) // 如無需過濾,可省略該操作
.readThen(path.toFile() ,artCrowd -> System.out.println(artCrowd.getName));
public class ArtCrowd {
// index代表列索引,從0開始
@ExcelColumn(index = 0)
private String name;
@ExcelColumn(index = 1)
private String age;
@ExcelColumn(index = 2,dateFormatPattern="yyyy-MM-dd")
private Date birthday;
}
[admin
]