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; } }
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())); }
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())); }
public static bool IsEmpty(this ExcelWorksheet sheet, int row, int col) { return(string.IsNullOrWhiteSpace(sheet.CellValue(row, col))); }