hutool-poi Excel文件(xls, xlsx)不支持csv
Hutool-poi是针对Apache POI的封装,因此需要用户自行引入POI库,Hutool默认不引入。到目前为止,Hutool-poi支持:
Excel文件(xls, xlsx)的读取(ExcelReader)
Excel文件(xls,xlsx)的写出(ExcelWriter)
具体代码
// pom
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>4.0.12</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>
public void hutoolRead() {
try {
excelPath = "C:\\Users\\admin\\Desktop\\开发任务分配.xlsx";
File excel = FileUtil.file(excelPath);
if (excel.isFile() && excel.exists()) { //判断文件是否存在
ExcelReader reader = ExcelUtil.getReader(excel);
//开始解析
List<Map<String, Object>> list = reader.readAll();
System.out.println(JSONObject.toJSON(list));
} else {
System.out.println("找不到指定的文件");
}
} catch (Exception e) {
e.printStackTrace();
}
}
具体参考api.
Hutool-poi是对Apache POI的封装,提供Excel(xls, xlsx)的读写功能,但不支持csv文件。用户需自行引入POI库。目前包括ExcelReader和ExcelWriter,详细功能见API文档。"
102241740,8446381,微信小程序头像挂件:使用canvas生成图片,"['小程序开发', '前端开发', 'canvas', '图像处理']
2255

被折叠的 条评论
为什么被折叠?



