如何查找列的名称或标题?
例如,如果我在excel中选择第5列,则意味着我希望结果为“E”。
如何获得与列号相对应的字母或字母
请帮助我的代码
最佳答案
使用Application.ActiveCell.get_Address(true, true, Excel.AlReferenceStyle.xlA1, missing, missing)
然后解析结果字符串或使用RegEx获取列标题怎么办?
我只是用了:
string location = Application.ActiveCell.get_Address(true, true, Excel.AlReferenceStyle.xlA1, missing, missing);
string tokens = x.Split("$".ToCharArray());
MessageBox.Show(String.Format("Column {0}", result[0]));