excel 写出

网友投稿 277 2022-11-16

excel 写出

public static void main(String[] args) { String fileName = "test.xlsx"; File file = new File(fileName); WriteSheet writeSheet = EasyExcel.writerSheet(fileName).build(); ArrayList 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(); }

com.alibaba easyexcel 3.0.5

@AllArgsConstructor@NoArgsConstructor@Datapublic class Student { @ExcelProperty("name") private String name; @ExcelProperty("age") private Integer age; @ExcelProperty("birthday") private LocalDateTime birthday;}

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Java IO及BufferedReader.readline()出现的Bug
下一篇:spring cloud nacos demo
相关文章

 发表评论

暂时没有评论,来抢沙发吧~