How to iterate through cells

say i have a worksheet.
and I want to access the value from a cell DS23, I can access this by cells(“DS23”).StringValue.

if i want to access the value of the next cell (i.e., DT23) how do I access it …
I don’t want to access by cells(“DT23”)
I need something like cells(“DS23”)+1 or something of that sort…

Second Qustion:
we have an obsolete function like
cells.columnnametoindex(string) is there any anothre equivalent function …


one other issue is when i acess cells(“DS23”).stringvalue i get “$32.00_)” where as the value in that cell is $32.00 … the forumula in the cell DS23 actually refers to AB23 so the value in AB23 is 32.00 … how can i get $32.00 but not $32.00_)






Hi,

Thanks for considering Aspose.

1). Please use CellsHelper class which has some static methods. You may try the following code:

Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
int row;
int col;
CellsHelper.CellNameToIndex("DS23",out row, out col);
string nextcell = CellsHelper.CellIndexToName(row,col+1);
MessageBox.Show("CellName: " + nextcell );

2). Please use CellsHelper.ColumnNameToIndex method for your need.

3). Please call Workbook.CalculateFormula() method before obtaining the value from DS23 cell. If you still find some problem, post your template file with sample code.

Thank you.