コード例 #1
0
        /// <summary>
        /// Reads a field, as a decimal.
        /// </summary>
        /// <param name="key">The column</param>
        /// <returns>The value</returns>
        /// <exception cref="InvalidCastException"></exception>
        public decimal?GetDecimal(string key)
        {
            string value = GetCellText(key);

            if (string.IsNullOrEmpty(value))
            {
                return(null);
            }

            decimal result;

            if (!ExcelCellFormatter.TryParseDecimal(value, out result))
            {
                throw new InvalidCastException();
            }

            return(result);
        }