项目中使用POI 5.0以后的依赖
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>5.2.3</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.1.2</version>
</dependency>
在函数中使用Cell.setCellType()时,会显示此函数过时
深入源码


虽然Cell
接口中的方法被@Deprecated
注解标识,但是抽象类CellBase
重写了该方法。看到这里就明白了,我们不用Cell
作为数据类型,也不用CellBase
的实现类,转用CellBase
抽象类作为数据类型。
解决方法
使用CellBase
类型的单元格对象