excel 写出
原创
文章标签 文件操作 excel 文章分类 Hadoop 大数据
©著作权归作者所有:来自51CTO博客作者武汉淘淘的原创作品,请联系作者获取转载授权,否则将追究法律责任
public static void main(String[] args) {
String fileName = "test.xlsx";
File file = new File(fileName);
WriteSheet writeSheet = EasyExcel.writerSheet(fileName).build();
ArrayList<Student> personArrayList = CollectionUtil.newArrayList();
personArrayList.add(new Student("Koala",12, LocalDateTime.now()));
personArrayList.add(new Student("Frank",23,LocalDateTime.now().plusDays(15)));
ExcelWriter writer = getWriter(file);
writer.write(personArrayList,writeSheet);
writer.finish();
}
public static ExcelWriter getWriter(File file){
return EasyExcel.write(file,Student.class).build();
}
<dependency>
<groupId>com.alibabagroupId>
<artifactId>easyexcelartifactId>
<version>3.0.5version>
dependency>
public class Student { ("name") private String name; ("age") private Integer age; ("birthday") private LocalDateTime birthday;}
- 赞
- 收藏
- 评论
- *举报
上一篇:org.junit.platform.commons.JUnitException: TestEngine with ID ‘junit-jupiter’ failed to discover te
下一篇:数据对象在层级之间的传递
Original: https://blog.51cto.com/u_15704977/5444728
Author: 武汉淘淘
Title: excel 写出
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/516732/
转载文章受原作者版权保护。转载请注明原作者出处!