当前位置:网站首页>EasyExcel简单使用
EasyExcel简单使用
2022-07-17 04:34:00 【等风来】
大概思路
easyExcel首先先要有Excel对象(就是一个excel文件),然后由Excel创建出sheet对象(就是excel中的一页),然后通过sheet进行读取每一行
简单读
不使用监听器读(监听器是可以为null的)
//
inputStream = multipartFile.getInputStream();
List<Book> list = EasyExcel.read(inputStream).head(Book.class).sheet().doReadSync();
//或者
List<Book> objects = EasyExcel.read("book.xlsx", Book.class, null).doReadAllSync();
它自己会判断,所以可以不用新建监听器类,太麻烦了
read方法,EasyExcel本身是没有的,但是它继承了EasyExcelFactory,
read方法支持
文件:
文件路径:
输入流:
简单写
List<Book> books=new ArrayList<>();
Book book=new Book();
book.setId(3);
book.setName("新华");
books.add(book);
//这是放在项目根路径下的
EasyExcel.write("book.xlsx", Book.class).sheet().doWrite(books);
边栏推荐
- Data types of basic knowledge of C language
- 树状数组:[JXOI2017]加法 题解
- Wechat e-book reading of small program graduation design (5) task book
- Phthon3 install mysqldb error problem solving reason: image not found
- How to configure binlog
- Optimization and configuration of OSPF
- [ruoyi Vue plus] learning notes 30 - redisson (VI) bounded blocking queue (redisson source code + Lua script)
- 64. Minimum path sum: given an M x n grid containing non negative integers, please find a path from the upper left corner to the lower right corner, so that the sum of the numbers on the path is the m
- 对称加密与非对称加密
- TiDB学习笔记【初阶】
猜你喜欢

C language explanation series - practice and consolidation of circular sentences, explanation of binary search

Virtual lab basic experiment tutorial -7 Polarization (3)

WildFly:如何从位于另一个应用程序中的 EJB 调用 EJB

智能硬件语音控制的时频图分类挑战赛2.0(思路以及结果,目前top5)

donet framework4. X==windows form application new project, through system Data. SqlClient connects to sqlserver to query

RK1126实现画中画功能 picture in picture for RK 1126

MySQL表的约束(基础篇)

Set administrator permissions for idea and console

李宏毅_机器学习_作业4(详解)_HW4 Classify the speakers

使用kaggle跑李宏毅机器学习作业
随机推荐
Gin framework principle
Eas (energy aware scheduling) green energy-saving scheduler
RK1126实现画中画功能 picture in picture for RK 1126
leetcode977. Square of ordered array
mysql中的视图、触发器和存储过程
LeetCode-移除元素
iptables防止nmap扫描以及binlog详解
T + 0 to t + 1! The quick redemption amount is reduced to 10000! Another bank adjusted the rules for the application and redemption of cash wealth management products
MySQL中的删除:delete、drop、Truncate三者的区别
The author of surging issued the pressure test results
STM32 - timer series (II) general timer
LeetCode之最大正方形(暴力求解和动态规划求解)
手机平台上的用户空间锁概述
OSPF的优化和配置
nodejs-uuid
Practice and improvement of children's network protection industry based on mobile Internet application
数据分析报告这样写,才算真正读懂了数据
C语言基础犄角旮旯的知识之数据类型
OSPF basic optimization
Analysis of network attack detection technology for NDN