Apache poi calculating cell address

28 Views Asked by At

How to get cell address when cell is null?

lets say i have the following excel

  A B C D
1 x x x x
2 x x   x
3 x x x x

When I am iterating inside a row over columns something like:

    for (i in 0 until lastCellNum) {
     val cell = row.getCell(i)
     if (cell != null){
       println(cell.address)
     } else {
       println("cell data is missing at address: "+ //address_calculation)
     }    
    }

How to print this?:

"cell data is missing at address: C2"

1

There are 1 best solutions below

0
beatrice On

If I create a celladdress by hand it will calculate it:

CellAddress(rowIndex,colIndex).formatAsString