// for colomn L InqDate_Current
// Set the data type of the entire column to date
Microsoft.Office.Interop.Excel.Range column_L = worksheet.Columns["L"];
column_L.NumberFormat = "yyyy-mm-dd";
// Get the range of the used cells in the column
Range usedRange_L = column_L.Cells.SpecialCells(XlCellType.xlCellTypeConstants);
i = 0;
// Loop through each cell in the column
foreach (Range cell in usedRange_L)
{
if (i != 0)
// Convert cell value to integer and assign it back to the cell
{
cell.Value = cell.Value;
}
i++;
}
在我的SSIS软件包数据流中,我有三个步骤:
通过OLE DB源retried数据将数据转换为正确的数据类型(数据转换转换编辑器)
excel中的save data。
不确定您所说的“真实日期”。 在Excel中,所有日期都是数字(代表日期时的整数),格式为日期。
,您的代码中的这一部分似乎没有很多意义。
{
cell.Value = cell.Value;
}
我认为您要做的是不仅仅设置NumberFormat,而是需要明确将单元格值转换为C#脚本中的日期:
thim,例如: