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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to get cell value object

Thread ID:





102293 Jan 18,2012 10:57 AM UTC Jan 19,2012 12:50 PM UTC WinForms 1
Tags: XlsIO
Asked On January 18, 2012 10:57 AM UTC

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 12:50 PM UTC

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.



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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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