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.

How to get cell value object

Thread ID:

Created:

Updated:

Platform:

Replies:

102293 Jan 18,2012 05:57 AM Jan 19,2012 07:50 AM Windows Forms 1
loading
Tags: XlsIO
Hugo
Asked On January 18, 2012 05:57 AM

How do I get the cell value as an object? I.e. something like this:

object valueObject = range.ValueObject;

So if the cell contains a string, valueObject will be of type string, if it is a number, it will be of type double etc.

My end goal is getting the value object, and using that as a key for a Dictionary. In this lookup table the number 2 is not considered the same as string "2".

Also is there a way to query the cell value type, rather than checking all the HasDateTime properties etc?

Best regards,

- Wout



Sridhar [Syncfusion]
Replied On January 19, 2012 07:50 AM

Hi Wout,

Thank you for using Syncfusion products.

1.Please use the Value2 property available with XlsIO to get the cell value as object. We have given below the code snippet for the same.

Code Snippet [C#] :

object value = worksheet.Range["A1"].Value2;

2.In the Dictionary the Number 2 and the string “2” values are considered differently.

3.We do not have the property to query the cell value type. Please use the object.GetType() property to get the type of the object.

Please let us know if you require any further clarifications.

Thanks,
Sridhar.S




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.

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.

;