Copy Range does not keep ListObject settings

Hi, I’ve found a problem when using the Range.Copy() method for copying a range containing a ListObject in the copied area.

In particular, the simple ListObject copy is fine, but if the list object has a TotalRow or there is an Excel function in the copied area referencing one of the table columns (as shown in the provided excel file), those are copied in the new area still referencing the ListObject of the original area.
Moreover, when using the TotalRow (SUBTOTAL functions), the copy operation will corrupt the file and Excel will try to recover it on open.

You can check this behaviour with the following lines and the provided template:

var workbook = new Workbook(@“TestCopyRangeWithListObjects.xlsx”);
var worksheet = workbook.Worksheets[0];
var copyRange = worksheet.Cells.CreateRange(“A1:E6”);
var targetRange = worksheet.Cells.CreateRange(“A7:E12”);
targetRange.Copy(copyRange);

If then you try to execute manually the same operation, you can see that Excel handles it as I’d expect.

Thanks in advance.

Hi,


Thanks for providing us template file and sample code.

After an initial test, I observed the issue as you mentioned by using your sample code with your template file. I found that copying a range (that involves a ListObject/Table) does not keep ListObject settings in the destination range. Furthermore, when using the Total row (SUBTOTAL functions), the copy operation will corrupt the output file and Excel will try to recover it on open.
e.g
Sample code:

var workbook = new Workbook(“e:\test2\TestCopyRangeWithListObjects.xlsx”);
var worksheet = workbook.Worksheets[0];

var copyRange = worksheet.Cells.CreateRange(“A1:E6”);
var targetRange = worksheet.Cells.CreateRange(“A7:E12”);
targetRange.Copy(copyRange);

workbook.Save(“e:\test2\out1.xlsx”);

I have logged a ticket with an id “CELLSNET-44214” for your issue. We will look into it soon.

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

Thank you.

Hi,

Thanks for using Aspose.Cells.

It is to inform you that we have fixed your issue CELLSNET-44214 now. We will soon provide the fix after performing QA and including other enhancements and fixes.

Hi,

Thanks for your using Aspose.Cells.

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-44214) have been fixed in this update.


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

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


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