当前位置:网站首页>项目中遇到的问题(五)操作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
边栏推荐
- Jenkins construction and use
- Antd design form verification
- 零拷貝技術
- leetcode--357. 统计各位数字都不同的数字个数
- Personal learning related
- [machine learning] Note 4. KNN + cross validation
- Analysis of redo log generated by select command
- MySQL and PgSQL time related operations
- RAC environment alert log error drop transient type: systp2jw0acnaurdgu1sbqmbryw = = troubleshooting
- Leetcode brush question 897 incremental sequential search tree
猜你喜欢

SQL learning | complex query

解决方案架构师的小锦囊 - 架构图的 5 种类型

MySQL and PgSQL time related operations

2021年秋招,薪资排行NO

Double pointer instrument panel reading (I)

Dolphin scheduler integrates Flink task pit records

Multithreading

服务器中挖矿病毒了,屮

Oracle defines self incrementing primary keys through triggers and sequences, and sets a scheduled task to insert a piece of data into the target table every second

Oracle job scheduled task usage details
随机推荐
MySQL [SQL performance analysis + SQL tuning]
Tensorflow Download
Technologie zéro copie
Express②(路由)
leetcode--380.O(1) 时间插入、删除和获取随机元素
[code analysis (5)] communication efficient learning of deep networks from decentralized data
Apache seatunnel 2.1.0 deployment and stepping on the pit
3300万IOPS、39微秒延迟、碳足迹认证,谁在认真搞事情?
[code analysis (1)] communication efficient learning of deep networks from decentralized data
[machine learning] Note 4. KNN + cross validation
PG library to view the distribution keys of a table in a certain mode
Two ways to deal with conflicting data in MySQL and PG Libraries
The query did not generate a result set exception resolution when the dolphin scheduler schedules the SQL task to create a table
Core concepts of microservice architecture
Reading notes: fedgnn: Federated graph neural network for privacy preserving recommendation
Information: 2021 / 9 / 29 10:01 - build completed with 1 error and 0 warnings in 11S 30ms error exception handling
Oracle and MySQL batch query all table names and table name comments under users
TCP reset Gongji principle and actual combat reproduction
UNIX final exam summary -- for direct Department
Express ② (routing)