myth-poi
More easy to Export & Import Excel&Word file.
1. How to install
A way: Build
- Clone this Repo And install
git clone https://github.com/Kuangcp/mythpoi.git
cd mythpoi && gradle install
Another way: Use gitee repository
Gradle
repositories {
maven{
url "https://gitee.com/kcp1104/MavenRepos/raw/master"
}
}
Maven
2. Add Dependency
2.1 Maven
<dependency>
<groupId>com.github.kuangcp</groupId>
<artifactId>myth-poi</artifactId>
<version>0.2.4-SNAPSHOT</version>
</dependency>
2.2 Gradle
compile("com.github.kuangcp:myth-poi:0.2.4-SNAPSHOT")
2.3 Jar Download About Jar
http://mvnrepository.com/artifact/org.jyaml/jyaml
http://mvnrepository.com/artifact/org.apache.poi/poi
https://gitee.com/kcp1104/MavenRepos/tree/master/com/github/kuangcp/myth-poi
3. How to use
Excel
- 1.Implement Interface:
- use annotation to define excelSheet column title and Sheet
- Just support BaseType field
@Data
@ExcelSheet(exportTitle = "雇员表", importTitle = "雇员表")
public class Employee implements ExcelTransform{
@ExcelConfig("姓名")
private String names;
@ExcelConfig("住址")
private String address;
// not export this field
@ExcelConfig(value = "QQ号码", exportFlag = false)
private String qq;
}
- 2.Export Excel file
List<Employee> originList = new ArrayList<>(); // add some Employee Object ... ExcelExport.exportExcel("/home/kcp/test/employee.xls", originList);
- 3.Import Excel file
List<Employee> result = ExcelImport.importExcel("/home/kcp/test/employee.xls", Employee.class);
Excel File :