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,
- CELLSNET-43603: Deleting the row makes the spreadsheet corrupted.
- CELLSNET-43604: ListObjects.DataRange does not update after deleting a row.
Hi Dimtry,
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.