public static String rc2name ( int row , int col ) { StringBuilder sb = new StringBuilder ( ) ; int b = 26 ; int p = 1 ; if ( col >= b ) { col -= b ; p *= b ; } if ( col >= b * b ) { col -= b * b ; p *= b ; } while ( p > 0 ) { sb . append ( ( char ) ( col / p + ( int ) ' ' ) ) ; col %= p ; p /= b ; } sb . append ( row + 1 ) ; return sb . toString ( ) ; }
Convert spreadsheet row column numbers to a cell name .