We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Problem with named cells

Thread ID:

Created:

Updated:

Platform:

Replies:

95702 Jul 26,2010 04:12 PM UTC Jul 28,2010 05:56 AM UTC ASP.NET Web Forms (Classic) 1
loading
Tags: XlsIO
Benoit Lecue
Asked On July 26, 2010 04:12 PM UTC

Hi,

I’d like to have two informations !
Actually, I have created in my excel file (in Excel not by using syncfusion) a defined name cell call “test”. The only way to get the text in this one is with the method “Range["test"].Text” and not thanks to the method : sheet.Names("CellName").Value. Is it normal ?
And secondly, I’d like to know if it’s possible to check if an defined named cell exist without crashing. Indeed, if the cell doesn’t exist in the Excel file, I’d like to know that by making a test. For the moment, I have always an exception and I don’t want to use a “try/catch”.

Thanks a lot!

Lokesh R [Syncfusion]
Replied On July 28, 2010 05:56 AM UTC

Hi Benoit,

Thank you very much for your interest on Syncfusion products.

I have analyzed the two queries posted in your last update and given below the details in separate headings.

sheet.Names("CellName").Value:

The Value property associated with the INames will return only the A-1 style notation of the referred range which we represent in the macros without a "=" sign. If you have to retrieve a value of the named range you need to use the below code snippet instead of the above.

[C#]
sheet.Names["Test"].ReferToRange.Value;

Named cell exist without crashing:

you can read all the named cells by iterating the INames collections. I have given below the code snippet for the same.

[C#]
foreach (IName namedCell in wkBook.Names)
{
if (namedCell.Name == "Test")
{
System.Console.WriteLine(namedCell.RefersToRange.Value);
}
}

[VB]

For Each namedCell As IName In wkBook.Names
If namedCell.Name = "Test" Then
System.Console.WriteLine(namedCell.RefersToRange.Value)
End If
Next namedCell

Please, let us know if you need any clarifications.

Thanks,
Lokesh.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;