Remove duplicate works for the first column only

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.

@komloshij,

After an initial test, I am able to reproduce the issue as you mentioned using your sample code. I found using remove duplicates feature works for the first column only when specifying columnOffsets parameter, if we skip the first column, it does not work. I have logged a ticket with an id “CELLSNET-47250” for your issue. We will look into it soon.

Once we have an update on it, we will let you know.

@komloshij,
This is to inform you that we have fixed your issue (logged earlier as “CELLSNET-47250”) now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

@komloshij,

Please try our latest version/fix: Aspose.Cells for .NET v20.3.2 (attached)

Your issue should be fixed in it.

Let us know your feedback.
Aspose.Cells20.3.2 For .Net2_AuthenticodeSigned.Zip (5.3 MB)
Aspose.Cells20.3.2 For .Net4.0.Zip (5.3 MB)

thank you.When do you think it would be available on nuget?

@komloshij,

Aspose.Cells for .NET v20.4 official release would be available before the end of third week of April 2020 hopefully.

The issues you have found earlier (filed as CELLSNET-47250) have been fixed in Aspose.Cells for .NET v20.4. This message was posted using Bugs notification tool by Amjad_Sahi

1 Like