This is a migrated thread and some comments may be shown as answers.

Getting Cell Name (A1, B1 etc)

1 Answer 223 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Evelyn
Top achievements
Rank 1
Evelyn asked on 11 Feb 2016, 05:24 PM

Hello, I am filling my spreadsheet programmatically.

I need the cell "name" to use it in a formula.. For example:

 

string formula = "=SUM(" + worksheet.Cells[row, column].GETNAME() + ";" + worksheet.Cells[row, column + 1].GETNAME() + ")";

 * This GETNAME method should return "A1", "B1", "C1", etc...

 

 And then, set the formula value to another cell: 

worksheet.Cells[row + 3, column].SetValue(formula);

 

 Is this the best way of doing this? Remember that the variables 'row' and 'column' are set before in a logic that I have to use. So it can change.

1 Answer, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 16 Feb 2016, 01:00 PM
Hello Evelyn,

Thank you for contacting us.

You may use the NameConverter class to convert cell indices and cell ranges to spreadsheet names. More specifically you may use ConvertCellIndexToName and ConvertCellRangeToName methods.

I hope this is helpful. If you have any other questions or concerns please do not hesitate to contact us again.

Regards,
Deyan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Spreadsheet
Asked by
Evelyn
Top achievements
Rank 1
Answers by
Deyan
Telerik team
Share this question
or