Getting Cell Name (A1, B1 etc)

2 posts, 0 answers
  1. Evil
    Evil avatar
    18 posts
    Member since:
    Mar 2015

    Posted 11 Feb Link to this post

    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.

  2. Deyan
    Admin
    Deyan avatar
    136 posts

    Posted 16 Feb Link to this post

    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
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top