There is a bug in the ClosedXML.Excel.IXLRow.Cell() function.
I open a workbook and access a worksheet. The worksheet has only one row, so row.Rownumber returns 1.
I access the second row of the sheet with worksheet.Row(2). Now lastUsedRow-Rownumber is 2.
Accessing row.Cell(1) returns the value of the first row's first cell.
I think in this case an exception should be thrown like NoExistingCell instead of returning the value from a different row.
Documentation says "Gets the cell in the specified column.". But what about the specified row?
It does not say "returns the cell form he specified column in the last used row."
This bug makes comparing two Excel-Files really difficult.
Dont know the algorithm, but accessing a not existing cell shoult throw an error.
Attached the Excel-Rows and visual studio immediate-output.
Comments: You know, users can put in all sort of stupid data. In which cases should i show a warning? What do you suggest? Should i redo my sorting so the Cell()-method will not throw stupid results? I suggest fixing the Cell() method. I am accessing Row(2).Cell(1).Value and get the value from the Row(1). Its a bug. Row(2).Cell(1).Value is "" but closedxml retunrs "bla", the value of Row(1).Cell(1).Value.
I open a workbook and access a worksheet. The worksheet has only one row, so row.Rownumber returns 1.
I access the second row of the sheet with worksheet.Row(2). Now lastUsedRow-Rownumber is 2.
Accessing row.Cell(1) returns the value of the first row's first cell.
I think in this case an exception should be thrown like NoExistingCell instead of returning the value from a different row.
Documentation says "Gets the cell in the specified column.". But what about the specified row?
It does not say "returns the cell form he specified column in the last used row."
This bug makes comparing two Excel-Files really difficult.
Dont know the algorithm, but accessing a not existing cell shoult throw an error.
Attached the Excel-Rows and visual studio immediate-output.
Comments: You know, users can put in all sort of stupid data. In which cases should i show a warning? What do you suggest? Should i redo my sorting so the Cell()-method will not throw stupid results? I suggest fixing the Cell() method. I am accessing Row(2).Cell(1).Value and get the value from the Row(1). Its a bug. Row(2).Cell(1).Value is "" but closedxml retunrs "bla", the value of Row(1).Cell(1).Value.