CSharp examples for Office:Excel
Excel Column Letter To Column Index
using Microsoft.Office.Interop.Excel; using System;/* w ww . j a v a2 s .co m*/ public class Main{ public static int ColumnLetterToColumnIndex(string columnLetter) { string columnLetterUpper = columnLetter.ToUpper(); int sum = 0; for (int i = 0; i < columnLetterUpper.Length; i++) { sum *= 26; sum += (columnLetterUpper[i] - 'A' + 1); } return sum; } }