We are evaluating Gembox as a replacement for Aspose. I think I am going blind as one thing I cannot do is easily get the address (e.g. "B4") of an ExcelCell.
For example, when iterating through the cells, we may encounter an unexpected value and would like to tell the user where the error is.
var dodgyCell = sheet.Cells[rowIndex, colIndex];
The best workaround I have found if to create a CellRange of one cell and then use the startposition. i.e.:
var cr = sheet.Cells.GetSubrangeAbsolute(rowIndex, colIndex, rowIndex, colIndex); var message = "Dodgy value was found in cell " + cr.StartPosition
Surely there has to be an easier way?
Seems that Original Poster has figured out the answer. Unfortunately it is not well visible so here it is again:
To convert row and column index to position string ("A1", "BN27", etc.) use static method
CellRange.RowColumnToPosition(int row, int column)
<strong>UPDATE</strong> In newer versions of GemBox.Spreadsheet (3.9 and above) the ExcelCell has an additional Name property which returns cell's address.
I know you've had the answer you are looking for but since someone else recommended a commercial product, I encourage you to look at epplus which is free, and coincidentally, I happened to have used today for the first time. It has many advanced features and a very simple and intuitive API.
According to the Gembox documentation, there is a "CellRange.ToString Method" that 'Returns a String that represents the current CellRange.' You might want to try that.