Get Cell Column Number & excel Column Name

Hi Dear Aspose,


I want to get “Column Number” & “Excel ColumnName” by column name with a commands like these,

int columnNumber = worksheet.Cells.Columns[“Teaj”];
//maybe columnNumber is 2


And Also get Column Namber base excel naming method
sting columnname= worksheet.Cells.ExcelColumns[“Teaj”];
//maybe columnNumber is A2

But what is correct Syntax for get these 2 thing.

Thanks.
Hi,

I think you may use some static methods of CellsHelper class for your needs.
E.g

CellIndexToName, CellNameToIndex, ColumnIndexToName, ColumnNameToIndex etc.


Sample code:
Workbook workbook = new Workbook();
Worksheet sheet = workbook.Worksheets[0];
Cell cell = sheet.Cells[0, 20];
string columnName = CellsHelper.ColumnIndexToName(cell.Column);
Debug.WriteLine(columnName);


Thank you.