Skip to content

goribun/excel-rw-annotation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

excel-rw-annotation

A simple tools for reading and writing excel by annotation

Example

annotation

    @ExcelField(name = "姓名")
    private String name;

    @ExcelField(name = "年龄", tags = {1})
    private int age;

    @ExcelField(name = "体重", format = "0.00")
    private BigDecimal weight;

    @ExcelField(name = "手机", order = 10, tags = {2, 3})
    private String mobile;

    @ExcelField(name = "生日", format = "yyyy-MM-dd")
    private Date birthday;

    @ExcelField(name = "性别", defaultValue = "保密")
    private String sex;

    @ExcelField(name = "周度", string = "第{{value}}周")
    private int weekly;

write

    byte[] bytes = ExcelHelper.write(personList, Person.class);
    //只导出注解tags包含2以及没有tags属性的字段
    byte[] bytes = ExcelHelper.write(personList, Person.class, 2);

read

    List<Person> personList = ExcelHelper.read(inputStream, Person.class);
    //读取excel文件为Map类型的列表
    List<Map<String, String>> list = ExcelHelper.read(inputStream);

About

A simple tools for reading and writing excel by annotation

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages