/// <summary> /// 获取Excel列名 /// </summary> /// <param name="columnNumber">从1开始的数字</param> /// <returns>列的序号,如:A、B、C、AA、BB</returns> public static string GetExcelColumnName(int columnNumber) { int dividend = columnNumber; string columnName = String.Empty; int modulo; while (dividend > 0) { modulo = (dividend - 1) % 26; columnName = Convert.ToChar(65 + modulo).ToString() + columnName; dividend = (int)((dividend - modulo) / 26); } return columnName; }