You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should analyse the second row to find the correct type and use that type
for the DataColumn.. Currently i only changed to add the DateTimeValue
instead of the Value.
for (int currentRowIndex = 1; currentRowIndex <= Cells.LastRowIndex;
currentRowIndex++)
{
DataRow dr = dt.NewRow();
object value = null;
for (int currentColumnIndex = 0; currentColumnIndex <=
Cells.LastColIndex; currentColumnIndex++) {
if (Cells[currentRowIndex, currentColumnIndex].IsEmpty)
dr[currentColumnIndex] = Cells[currentRowIndex,
currentColumnIndex];
else {
switch (Cells[currentRowIndex,
currentColumnIndex].Format.FormatType)
{
case CellFormatType.Date:
case CellFormatType.Time:
case CellFormatType.DateTime:
value = Cells[currentRowIndex,
currentColumnIndex].DateTimeValue;
break;
default:
value = Cells[currentRowIndex,
currentColumnIndex].Value;
break;
}
dr[currentColumnIndex] = value;
}
}
dt.Rows.Add(dr);
}
Original issue reported on code.google.com by marco.di...@gmail.com on 11 Feb 2009 at 10:01
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
marco.di...@gmail.com
on 11 Feb 2009 at 10:01The text was updated successfully, but these errors were encountered: