public static int ExcelColumnNameTonumber(string columnName){ if (string.IsNullOrEmpty(columnName)) throw new ArgumentNullException("columnName"); columnName = columnName.ToUpperInvariant(); int sum = 0; for (int i = 0; i < columnName.Length; i++) { sum *= 26; sum += (columnName[i] - 'A' + 1); } return sum;}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)