public static void main(String[] args) {
List<ExcelExportEntity> beanList = new ArrayList<ExcelExportEntity>();
//列名
beanList .add(new ExcelExportEntity("学生姓名", "name"));
beanList .add(new ExcelExportEntity("学生性别", "sex"));
beanList .add(new ExcelExportEntity("进校日期", "registrationDate"));
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
//填充内容
for (int i = 0; i <3 ; i++) {
Map<String, Object> valMap = new HashMap<String, Object>();
valMap.put("name", 1);
valMap.put("sex", "yy");
valMap.put("registrationDate", "zz");
//添加
list.add(valMap);
}
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("测试", "测试"), beanList ,
list);
FileOutputStream fos = null;
try {
fos = new FileOutputStream("D:/价格分析表.tt.xls");
workbook.write(fos);
} catch (Exception e) {
e.printStackTrace();
}
}
Easy poi 动态导出列
最新推荐文章于 2024-05-07 17:19:41 发布