RemoveDuplicates with columnOffsets works only for the first column in the range
I have the following code:
var workbook = new Workbook();
var sheet = workbook.Worksheets[0];
sheet.Cells[0, 0].Value = “Col A”; sheet.Cells[0, 1].Value = “Col B”; sheet.Cells[0, 2].Value = “Col C”;
sheet.Cells[1, 0].Value = “A1”; sheet.Cells[1, 1].Value = “B1”; sheet.Cells[1, 2].Value = “C1”;
sheet.Cells[2, 0].Value = “A2”; sheet.Cells[2, 1].Value = “B2”; sheet.Cells[2, 2].Value = “C2”;
sheet.Cells[3, 0].Value = “A1”; sheet.Cells[3, 1].Value = “B1”; sheet.Cells[3, 2].Value = “C1”;
sheet.Cells[4, 0].Value = “A3”; sheet.Cells[4, 1].Value = “B3”; sheet.Cells[4, 2].Value = “C3”;
sheet.Cells[5, 0].Value = “A2”; sheet.Cells[5, 1].Value = “B2”; sheet.Cells[5, 2].Value = “C2”;
It creates the following table on the worksheet:
Col A Col B Col C
A1 B1 C1
A2 B2 C2
A1 B1 C1
A3 B3 C3
A2 B2 C2
Then I execute the following code:
var columnOffsets = new int[] { 0 };
sheet.Cells.RemoveDuplicates(sheet.Cells.MinDataRow, sheet.Cells.MinDataColumn, sheet.Cells.MaxDataRow, sheet.Cells.MaxDataColumn, true, columnOffsets);
As a result, the table will become the following:
Col A Col B Col C
A1 B1 C1
A2 B2 C2
A3 B3 C3
But if I change the columnOffsets to one of the following:
var columnOffsets = new int[] { 1 }; or
var columnOffsets = new int[] { 2 }; or
var columnOffsets = new int[] { 1, 2 }; then the table remains as it was initially:
Col A Col B Col C
A1 B1 C1
A2 B2 C2
A1 B1 C1
A3 B3 C3
A2 B2 C2
So the RemoveDuplicates function doesn’t work for columns other then the first one in the range.