-
Notifications
You must be signed in to change notification settings - Fork 325
CSV export
清沐 edited this page Feb 21, 2020
·
1 revision
try(Csv csv = CsvBuilder.of(People.class).build(getDataList())){
AttachmentExportUtil.export(csv.getFilePath(), "test.csv", response);
// csv.write(Paths.get("/User/append.csv"));
}
Map type is Map<String,Object>
try(Csv csv = CsvBuilder.of(Map.class).build(getMapList())){
AttachmentExportUtil.export(csv.getFilePath(), "test.csv", response);
// csv.write(Paths.get("/User/append.csv"));
}
try(CsvBuilder<CsvPeople> csvBuilder = CsvBuilder.of(People.class)){
for (int i = 0; i < 10; i++) {
csvBuilder.append(data(1000));
}
Csv csv = csvBuilder.build();
AttachmentExportUtil.export(csv.getFilePath(), "test.csv", response);
// csv.write(Paths.get("/User/append.csv"));
}
try(CsvBuilder<CsvPeople> csvBuilder = CsvBuilder.of(People.class).noTitles()){
for (int i = 0; i < 10; i++) {
csvBuilder.append(data(1000));
}
Csv csv = csvBuilder.build();
// This method will continue to append data in the original append.csv file instead of overwriting
csv.write(Paths.get("/User/append.csv"),true);
}
Bean Definition
public class People {
@ExcelColumn(order = 0, title = "姓名")
private String name;
@ExcelColumn(order = 1, title = "年龄")
private Integer age;
@ExcelColumn(order = 2, title = "性别")
private String gender;
}
Compared with Excel export annotation, support attributes are reduced, width and style attributes are not supported. Please move to annotation
-
Overview
概述 -
FAQ
常见问题 -
Dependency adding
依赖添加 -
Excel/Csv import
Excel/Csv导入 - 一对多导入
-
Excel default export
默认导出 -
Excel streaming export
流式导出 -
Dynamic export
动态导出 -
Excel template build
模板构建 -
CSV export
csv导出 -
Multiple sheet import
多sheet导入 -
Multiple sheet export
多sheet导出 - 聚合列&聚合导出
-
Custom style
自定义样式 -
Multilevel header
多级表头 -
Wrap within cell
单元格内换行 -
Image export
图片导出 -
Image import
图片导入 -
Hyperlink
链接 - 读取链接
-
Template row height setting
模板行高度设置 -
Drop-down-list
下拉列表 -
Custom convert
写入自定义转化 -
Formula usage
公式使用 -
Template cell setting
单元格设置 -
Header freeze
区域冻结 - 提示
-
Style support
样式支持 - 添加水印
- 按列读取
- 单元格斜线绘制
- 设置批注
- 版本日志