基于JAVA的CSV导入导出 A library for import & export CSV in JAVA, Easy to use!
- add @CSVColumn annotation to exported attributes
- index is not necessary, but without declared index, this column will be appended to the tail.
public class Demo implements Serializable{
private static final long serialVersionUID = -390518098324231014L;
@CSVColumn(name = "test1", index = 0)
private String test1;
@CSVColumn(name = "test3")
private String test3;
@CSVColumn(name = "test4")
private String test4;
@CSVColumn(name = "test2", index = 1)
private String test2;
}- call ExportCSVUitls
CSVFileInfo csvFileInfo = ExportCSVUtils.export(input, Demo.class, "test.csv");see you soon...
Not yet upload to the maven repo, so you should download the source code, and install locally.
Then import this Maven coordinates:
<dependency>
<groupId>org.benny.util</groupId>
<artifactId>easycsv</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
Email me: [email protected]