public static class ExcelFunc
{
public static string ConvertToLetter(int colIndex)
{
string ret = string.Empty;
var alpha = colIndex/27;
var remainder = colIndex-(alpha*26);
if (alpha > 0)
ret = Char.ConvertFromUtf32(alpha+64);
if (remainder > 0)
ret += Char.ConvertFromUtf32(remainder+64);
return ret;
}
}
lunedì 5 dicembre 2011
Conversione di un numero in colonna Excel
Ecco il codice per convertire un numero nell'indice alfanumerico di una colonna Excel:
Iscriviti a:
Commenti sul post (Atom)
Nessun commento:
Posta un commento