This project has moved. For the latest updates, please go here.

Get formula's value

Nov 20, 2014 at 12:35 AM
http://closedxml.codeplex.com/workitem/7614

I have try get the valuecached but its null sometimes.
And do u have a good way to get the value ? Thank U.
       object objValue = null;
            if (cell.HasFormula)
            {
                double tmpTime = 0;
             
                if (type.Equals(typeof(DateTime)) && Double.TryParse(cell.ValueCached, out tmpTime))
                    objValue = DateTime.FromOADate(Convert.ToDouble(cell.ValueCached));

                else
                {
                    try
                    {
                        objValue = cell.Value;
                    }
                    catch
                    {
                        objValue = cell.ValueCached;
                    }
                }
            }
            else
            {
                objValue = cell.Value;
            }
because when i got the cell.Value directly it will throw the exception .
I need your help.