Exemplo n.º 1
0
        private string getDataType(Range cell)
        {
            string            result = "";
            WorksheetFunction func   = cell.Application.WorksheetFunction;

            if (func.IsLogical(cell))
            {
                result = "boolean";
            }
            else if (func.IsNumber(cell))
            {
                try
                {
                    Convert.ToDateTime(cell.Text);
                    result = "date";
                }
                catch
                {
                    result = "decimal";
                }
            }
            else //if (func.IsText(cell))
            {
                result = "string"; //default type is string
            }
            return(result);
        }