use of com.hummer.excel.plugin.test.model.HeaderDemo2 in project hummer-framework by hummer-team.
the class ReaderTest method testTableExcel.
@Test
public void testTableExcel() {
List<TableWriteDataBo> list = new ArrayList<>(2);
TableWriteDataBo bo = new TableWriteDataBo();
bo.setHeadClass(HeaderDemo.class);
bo.setDataInfos(data(1, HeaderDemo.class));
TableWriteDataBo bo2 = new TableWriteDataBo();
bo2.setHeadClass(HeaderDemo2.class);
bo2.setDataInfos(data(5, HeaderDemo2.class));
list.add(bo);
list.add(bo2);
String sheet = "模板";
String fileName = TestFileUtil.getPath() + "tableWrite" + System.currentTimeMillis() + ".xlsx";
File file = new File(fileName);
FileOutputStream outputStream = null;
try {
outputStream = new FileOutputStream(file);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
TableWriteTemplate.getInstance().tableWrite(list, sheet, outputStream);
}
Aggregations