我使用 Microsoft.Office.Interop.Excel 上传了一个 Excel 电子表格。当我尝试读取具有日期值的单元格以便将其插入我的数据集中时,它不会被识别为日期并且它会作为随机数出现?这是我指代细胞的方式:
Excel.Range startDate = objsheet.get_Range("C1:C" + lastUsedRow, System.Type.Missing);
double dbl = Convert.ToDouble(startDate);
DateTime conv = DateTime.FromOADate(dbl);
(row[3] = ((Microsoft.Office.Interop.Excel.Range)objsheet.Cells[rowIndex, 4]).Value2;)