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

ConvertCellNameToIndex - issue

2 Answers 127 Views
SpreadProcessing
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Iron
Iron
Veteran
Dan asked on 08 Jan 2018, 10:06 AM

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 Answers, 1 is accepted

Sort by
0
Dan
Top achievements
Rank 1
Iron
Iron
Veteran
answered on 08 Jan 2018, 11:25 AM

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.

0
Tanya
Telerik team
answered on 10 Jan 2018, 03:38 PM
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

Tags
SpreadProcessing
Asked by
Dan
Top achievements
Rank 1
Iron
Iron
Veteran
Answers by
Dan
Top achievements
Rank 1
Iron
Iron
Veteran
Tanya
Telerik team
Share this question
or