Skip to content

WillTong/excel4j

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

excel4j

Build Status codecov Dependency Status License

A java library for reading and writing microsoft office excel file.Thanks to POI.

Getting started

  • Define an entity
@Excel
@Sheet("example")
public class Example {
    @Cell("testing string")
    private String paramStr;
    @Cell("testing number")
    private Integer paramInt;
    @Cell(value="testing date",dateFormat="yyyy-MM-dd")
    private Date date;
}
  • list to xls
public class Export {
    public void export(){
        List<Example> list=new ArrayList();
        FileOutputStream fout = new FileOutputStream("/test.xls");
        fout.write(Excel4j.opsWrite().fromList(list));
        fout.close();
    }
}
  • xls to list
public class Export {
    public void export(){
        byte[] data=new byte[1];
        List<Example> list = Excel4j.opsRead(data)
        .toList(Example.class);
    }
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages