把EXCEL列号数字变成字母

把Excel 列号数字变成字母

        private static string ToName(int index)
{
if (index < 0) { throw new Exception("invalid parameter"); }
List<string> chars = new List<string>();
do
{
if (chars.Count > 0) index--;
chars.Insert(0, ((char)(index % 26 + (int)'A')).ToString());
index = (int)((index - index % 26) / 26);
} while (index > 0);
return String.Join(string.Empty, chars.ToArray());
}

  

上一篇:【翻译习作】 Windows Workflow Foundation程序开发-第一章04


下一篇:ubuntu(14.04) 网路管理