[原创] [C#] 转换Excel数字列号为字母列号

时间:2015-05-05 23:42:52   收藏:0   阅读:450

转换Excel数字列号为字母列号

例如:

0 -> A

26 -> AA

 

private static string GetColumnChar(int col)
{
    var a = col / 26;
    var b = col % 26;
    
    if (a > 0) return GetColumnChar(a - 1) + (char)(b + 65);

    return ((char)(b + 65)).ToString();
}

 

原文:http://www.cnblogs.com/oneisyou/p/4480554.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!