Пример #1
0
 public static DateTime CellDateValue(this ExcelWorksheet sheet, int row, int col, DateTime defaultDate)
 {
     if (string.IsNullOrWhiteSpace(sheet.CellValue(row, col)))
     {
         return(defaultDate);
     }
     System.Threading.Thread.CurrentThread.CurrentCulture   = new System.Globalization.CultureInfo("nl-BE");
     System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("nl-BE");
     try
     {
         //try to parse as a date
         var value = sheet.Cells[row, col].Value;
         if (value is DateTime)
         {
             return((DateTime)value);
         }
         else
         {
             //parse the value as a number
             double dateNum = double.Parse(value.ToString());
             return(DateTime.FromOADate(dateNum));
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #2
0
        public static PlayerAction?CellPlayerAction(this ExcelWorksheet sheet, int row, int col)
        {
            var value = sheet.CellValue(row, col);

            if (value == null)
            {
                return(null);
            }

            return(EnumExtensions.GetEnumFromValue <PlayerAction>(value.Trim()));
        }
Пример #3
0
        public static CardRank?CellCardRank(this ExcelWorksheet sheet, int row, int col)
        {
            var value = sheet.CellValue(row, col);

            if (value == null)
            {
                return(null);
            }

            return(EnumExtensions.GetEnumFromValue <CardRank>(value.Trim()));
        }
Пример #4
0
 public static bool IsEmpty(this ExcelWorksheet sheet, int row, int col)
 {
     return(string.IsNullOrWhiteSpace(sheet.CellValue(row, col)));
 }