ConvertCellNameToIndex - issue

3 posts, 0 answers
  1. Dan
    Dan avatar
    100 posts
    Member since:
    Nov 2017

    Posted 08 Jan Link to this post

    Hi,

    I am evaluating the use of SpreadProcessing for downloading an excel file created from a "template excel file" where cells are filled with values.

    In order to change the template we are using named ranges to know where to place the values. On forum I have found a thread where this functionality was requested and someone provide a solution using ConvertCellNameToIndex.

    However when I tried it I got an exception:

    Telerik.Windows.Documents.Spreadsheet.Utilities.LocalizableException occurred
      HResult=-2146233088
      LocalizationKey=Spreadsheet_ErrorExpressions_InvalidRowName
      Message='4 evaluare'!$B$1' is invalid row name.
      Source=Telerik.Windows.Documents.Spreadsheet
      StackTrace:
           at Telerik.Windows.Documents.Spreadsheet.Utilities.NameConverter.ConvertRowNameToIndex(String rowName)
      InnerException: 
           HResult=-2146233079
           Message='4 evaluare'!$B$1' is invalid row name.
           InnerException: 

    This is the cellName used => "='Anexa4 evaluare'!$B$1"

    Is this an issue? What are my options in order to not get this error?

  2. Dan
    Dan avatar
    100 posts
    Member since:
    Nov 2017

    Posted 08 Jan in reply to Dan Link to this post

    Hi,

    It seems I was sending all the RefersTo string to the ConvertCellNameToIndex but after removing the sheet I still got an error: '$B$' is invalid column name.

    So it seems that I have to remove the $ sign from the cell before retrieving it.

  3. Tanya
    Admin
    Tanya avatar
    718 posts

    Posted 10 Jan Link to this post

    Hi Dan,

    You can use the absolute names (with $) - the issue is related to the worksheet name and the '=' sign that are passed along with the cell name. The ConvertCellNameToIndex() method cannot work with references to different worksheets but only with cell names. The '=' sign is treated as the start of a formula and shouldn't be included in the name of the cell. The string that is passed to the method is treated only as a name and that is why it shouldn't start with '='.

    I hope this information is helpful.

    Regards,
    Tanya
    Progress Telerik

Back to Top