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: Dont understand why after sorting the Row(2)-methode is not taking the second row. It takes the first row but I did not wirte Row(1). I think you used the lastRowUsed() in your code instead of throwing an exception. Row(2) should trow an exception or return a null. I want the value of thje Row(2).Cell(1) not the value from row 1. I programmed a low level api for apache-poi in java, so I know how difficult this can be. Tried once a word api for open-xml. I failed ;)
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: Dont understand why after sorting the Row(2)-methode is not taking the second row. It takes the first row but I did not wirte Row(1). I think you used the lastRowUsed() in your code instead of throwing an exception. Row(2) should trow an exception or return a null. I want the value of thje Row(2).Cell(1) not the value from row 1. I programmed a low level api for apache-poi in java, so I know how difficult this can be. Tried once a word api for open-xml. I failed ;)