I tried to verify what you were seeing and ended up seeing the
behavior I would expect and couldn't find an actual issue, so either
I'm not understanding the issue or something else. The logic of
CurrentRecord is not necessarily meant to match Excel's row numbers,
but instead match the logical record numbers of the other readers and
from an actual data perspective. Here was my test scenario. I have an
Office 95 style spreadsheet called test.xls and I'm using the
XlsReader. It's a couple of simple columns and rows with the data
below using pipes to show you where my columns are defined:
|col1|col2|
|a|d|g|
|b|e|
|c|
And here's my test code that currently passes not showing an issue
with the current code from my perspective anyhow:
using (XlsReader reader = new XlsReader("../../test.xls"))
{
reader.CurrentSheet = 0;
reader.Settings.HasHeaders = false;
// this should put it on the record starting with "a"
reader.CurrentRecord = 1;
// this should advance it to the record starting with "b"
Assert.IsTrue(reader.ReadRecord());
Assert.AreEqual("b", reader[0]);
// this should have it read the first record as headers and
// start everything else at the record starting with "b"
reader.Settings.HasHeaders = true;
// this should put it on the record starting with "b"
reader.CurrentRecord = 1;
// this should advance it to the record starting with "c"
Assert.IsTrue(reader.ReadRecord());
Assert.AreEqual("c", reader[0]);
}
Bruce Dunwiddie
On Jun 20, 12:43 pm, "
norb...@carlislegroup.com"
> > > Thanks.- Hide quoted text -
>
> - Show quoted text -