Apache poi Excel: Creating a formula based on the integer index of the column
问题 Say that my column number is 26, when I create a formula my formula should look like, say: SUM(AA1:AA3) for example. but how do I translate 26 to AA? Or say 27 to AB? Is there a way for Apache POI to use Column index as an integer and translate it into its letter representation? 回答1: That requires just a little code: public static String columnName(int index) { StringBuilder s = new StringBuilder(); while (index >= 26) { s.insert(0, (char) ('A' + index % 26)); index = index / 26 - 1; } s