导出Excel模版 - wujiuye/miniexcel GitHub Wiki
在实际项目开发中,为了导入数据时能够正确读取,通常需要为某个业务生成一个excel模版,让运营根据模版填写表单,再导入。
导出模版的demo如下:
public class DataExportTest{
@Test
public void testExportTemplate() {
AbstractExcelWriter excelWriter = AbstractExcelWriter.createExcelWriter("/tmp/miniexcel-test", ExcelFileType.XLSX);
// ExcelWriteListenerAdapter导出监听器参数1为需要导出的数据,传null则只会导出标题
excelWriter.write(new ExcelWriteListenerAdapter<DateModel>(null, 1) {});
}
}