代码拉取完成,页面将自动刷新
#easyexcel
###以前看到一个注解读写excel的工程。。。实在忘记他叫啥了。。。
##特性
- 注解支持
- 格式化支持
##code example
#Book
//PropertyCell 可以指定自定义cell处理器 具体实现看 format包 format=AAFormat.class formatParam="xxx" 这个会作为AAFormat 的参数, order 参数为写入excel的顺序
@PropertyCell(title="id")
private Integer id;
@PropertyCell(title="名称")
private String name;
@PropertyCell(title="数量")
private Integer count;
@PropertyCell(title="创建日期", formatParam="yyyy-MM-dd")
private Date createDate;
@Test
public void readTest() {
try {
List<Book> bookList = ExcelHelper.readList(this.getClass().getResource("/test.xlsx").getPath(), Book.class);
printList(bookList);
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void writeTest() {
try {
List<Book> bookList = new ArrayList<Book>();
for (int i = 0; i < 5; i++) {
Book book = new Book();
book.setId(i);
book.setName("书名_" + i);
book.setCount(RandomUtils.nextInt(100));
bookList.add(book);
}
printList(bookList);
System.out.println();
String path = this.getClass().getResource("/").getPath();
System.out.println("输出路径 : " + path);
ExcelHelper.writeList(path + "test_" + System.currentTimeMillis() + ".xlsx", bookList);
} catch (Exception e) {
e.printStackTrace();
}
}
@
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。