当前位置:网站首页>项目中遇到的问题(五)操作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
边栏推荐
- Oracle clear SQL cache
- 神经元与神经网络
- [code analysis (3)] communication efficient learning of deep networks from decentralized data
- Jenkins construction and use
- Reading notes: Secure federated matrix factorization
- Express②(路由)
- Using Jupiter notebook in virtual environment
- Express ② (routing)
- Express middleware ③ (custom Middleware)
- Reading notes: fedgnn: Federated graph neural network for privacy preserving recommendation
猜你喜欢
随机推荐
Analysis of cluster component gpnp failed to start successfully in RAC environment
Tersus notes employee information 516 MySQL query (time period uniqueness judgment of 2 fields)
[code analysis (5)] communication efficient learning of deep networks from decentralized data
Move blog to CSDN
初探 Lambda Powertools TypeScript
Oracle generates millisecond timestamps
Oracle renames objects
Influence of openssh version on SSH mutual trust creation in RAC environment
Es introduction learning notes
Function executes only the once function for the first time
Oracle index status query and index reconstruction
Solution of discarding evaluate function in surprise Library
Tensorflow Download
剑南春把文字游戏玩明白了
[VMware] address of VMware Tools
[Video] Bayesian inference in linear regression and R language prediction of workers' wage data | data sharing
3300万IOPS、39微秒延迟、碳足迹认证,谁在认真搞事情?
Using Baidu Intelligent Cloud face detection interface to achieve photo quality detection
JS compares different elements in two arrays
零拷貝技術