Reputation: 12431
I am a little bit lost with version of
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
I tried version 3.17, 4.0.0 and 5.0.0.
if (c.getCellType () == CellType.NUMERIC.getCode())
{
}
or
if (c.getCellTypeEnum () == CellType.NUMERIC)
{
}
I was not able to get a code free of deprecation or type-errors :-(
I am using Eclipe with Maven and Java 11. After the cange of the version I did "Update Project" to update Maven.
Upvotes: 2
Views: 6435
Reputation: 61945
In apache poi 3.17
Cell.getCellType
returns a int
but is deprecated. Cell.getCellTypeEnum
returns a CellType
. See apache poi 3.17 API: Interface Cell.
So using apache poi 3.17
it must be
if (cell.getCellTypeEnum() == CellType.NUMERIC)
In apache poi
greater than or equal version 4.0.0
Cell.getCellType
returns a CellType
. Cell.getCellTypeEnum
also returns a CellType
but is deprecated. See apache poi 4.0 API: Interface Cell.
So using apache poi
greater than or equal version 4.0.0
it must be
if (cell.getCellType() == CellType.NUMERIC)
Upvotes: 6