Fails to remove the last row of a ListObject and saved workbook show an error when open in Excel

The following test method reproduces the issue, when Cells.DeleteRows applied to the last row of a ListObject does nothing. And if the workbook is saved then, Excel reports an error when opens it.



[Fact]

public void AsposeDoesntRemoveTheLastRowAndSavedWorkbookOpensWithAnErrorInExcel()

{

var workbook = new Workbook();

var worksheet = workbook.Worksheets[0];

worksheet.Cells.ImportTwoDimensionArray(new object[2,2] {{“11”, “12”}, {“21”, “22”}}, 0, 0);

worksheet.ListObjects.Add(0, 0, 1, 1, false);

var table = worksheet.ListObjects[0];

table.ShowHeaderRow = false; // remove header leaving the first row empty



Assert.Equal(2, table.DataRange.RowCount);

Assert.Equal(1, table.StartRow);

Assert.Equal(2, table.EndRow);



worksheet.Cells.DeleteRows(2, 1, true);



workbook.Save(“result.xlsx”);



Assert.Equal(1, table.DataRange.RowCount); // fails, table.DataRange.RowCount is 2 not 1 as expected

Assert.Equal(1, table.StartRow);

Assert.Equal(1, table.EndRow); // fails, table.EndRow is 2 not 1 as expected

}

Hi Dimtry,


Thank you for raising this issue. We have tested this scenario with latest revision of Aspose.Cells for .NET 8.4.1.1, and we are able to see the problem. Following two tickets have been logged in our bug tracking system to investigate & correct the behavior Cells.DeleteRows.

  1. CELLSNET-43603: Deleting the row makes the spreadsheet corrupted.
  2. CELLSNET-43604: ListObjects.DataRange does not update after deleting a row.

Please allow us sometime to look into the matter. In the meanwhile, we will keep you posted with updates in this regard.

Hi Dimtry,


This is to inform you that we have resolved both tickets attached to this thread, and we will provide the fix with weekly interim release after performing QA and incorporating other enhancements.

Great, thanks.

Hi,

Thanks for your using Aspose.Cells.

We have fixed the issue CELLSNET-43603.

Please download and try the latest fix: Aspose.Cells for .NET (Latest Version) and let us know your feedback.

The issues you have found earlier (filed as CELLSNET-43604;CELLSNET-43603) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.