当前位置:网站首页>项目中遇到的问题(五)操作Excel接口Poi的理解
项目中遇到的问题(五)操作Excel接口Poi的理解
2022-04-23 13:51:00 【秃头侠客】
excel有多种数据类型,这里只对.xlsx类型做讨论
excel格式
- 打开Excel左下角可以看到有sheet,一个sheet就是一页,Excel可以有多个sheet
- sheet中有好多行row
- 每一行中会有很多单元格cell
创建excel的思路
- 首先通过ExcelWriter,这个类可以传入新建的或已有的Excel文件,对里面的数据进行操作处理
- 可以通过XSSFWorkbook类去创建sheet
- 然后再sheet中对row和cell处理(此处是对缓存的处理)
- 通过ExcelWriter.write()将数据传输到文件中。记得flush
遇到的问题
-
到的版本不同,可能会导致有些方法运行时无法找到,出现异常
-
传入文件名时,文件名可能会被转转移,导致类型出错。可以使用该插件
<!-- 让maven不编译xls文件,但仍将其打包 --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <configuration> <nonFilteredFileExtensions> <nonFilteredFileExtension>xls</nonFilteredFileExtension> <nonFilteredFileExtension>xlsx</nonFilteredFileExtension> </nonFilteredFileExtensions> </configuration> </plugin>
-
new file excel为空文件,在ExcelWriter中传入文件时报错。
版权声明
本文为[秃头侠客]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_44620773/article/details/124325329
边栏推荐
- Zero copy technology
- JS compares different elements in two arrays
- Modification of table fields by Oracle
- Multithreading
- elmo(BiLSTM-CRF+elmo)(Conll-2003 命名实体识别NER)
- Es introduction learning notes
- Apache seatunnel 2.1.0 deployment and stepping on the pit
- Jiannanchun understood the word game
- 【项目】小帽外卖(八)
- Function executes only the once function for the first time
猜你喜欢
Special window function rank, deny_ rank, row_ number
Leetcode? The first common node of two linked lists
ACFs file system creation, expansion, reduction and other configuration steps
【项目】小帽外卖(八)
Leetcode | 38 appearance array
Express middleware ③ (custom Middleware)
Lenovo Saver y9000x 2020
Solution of discarding evaluate function in surprise Library
OSS cloud storage management practice (polite experience)
大专的我,闭关苦学 56 天,含泪拿下阿里 offer,五轮面试,六个小时灵魂拷问
随机推荐
The art of automation
elmo(BiLSTM-CRF+elmo)(Conll-2003 命名实体识别NER)
Express中间件③(自定义中间件)
JS time to get this Monday and Sunday, judge the time is today, before and after today
Reading notes: fedgnn: Federated graph neural network for privacy preserving recommendation
Building MySQL environment under Ubuntu & getting to know SQL
About me
Kettle--控件解析
Apache Atlas Compilation and installation records
Jiannanchun understood the word game
低频量化之明日涨停预测
Express②(路由)
Oracle clear SQL cache
Zero copy technology
Oracle lock table query and unlocking method
Ora-16047 of a DG environment: dgid mismatch between destination setting and target database troubleshooting and listening vncr features
Three characteristics of volatile keyword [data visibility, prohibition of instruction rearrangement and no guarantee of operation atomicity]
Publish custom plug-ins to local server
解决方案架构师的小锦囊 - 架构图的 5 种类型
Antd design form verification