darknessomi / darknessomi/excellibrary

test for FormatTypes in DatasetTable.PopulateTable

Open
#9 0 comments 0 reactions 0 assignees View on GitHub
auto-migrated Priority-Medium Type-Enhancement
Dominant language
C#
Stars
22
Forks
8
PR merge metrics
No merged PRs in 30d

Description

```
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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at DatasetTable.PopulateTable and trace how DataColumns are created from row values and FormatTypes are handled. Add a regression test covering a second-row date, time, or datetime value, then run the existing test suite; done means the column type and stored value match the detected format.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.