实现功能
具体操作
///获取指定路径下的文件,如果不存在文件会自动进行创建
private static String filePath = "/tmp/blog";
private WorkbookXssHss xssFWorkbook = WorkbookXssHss.getInstance(filePath, WorkbookXssHss.WORKBOOK_XSSF);
获取文件中的信息,返回指定类型的对象列表
List<Blog> datas = xssFWorkbook.readFromExcel(Blog.class);
/将列表中的对象,以类中字段顺序写入excel文件
List<Object> objectInfoList ;
xssFWorkbook = WorkbookXssHss.getInstance(filePath,WorkbookXssHss.WORKBOOK_XSSF);
xssFWorkbook.setSheetName("没有神的过往");
xssFWorkbook.writeToExcel(objectInfoList);
V1.0 Bug 日志
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.17</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>
Java版本