Shapes getting copied incorrectly when using Worksheet.Cells.CopyRows

If you create a template spreadsheet with a shape (TextBox) (entirely enclosed) in cell A1 and then run the following code to make a copy of Excel row 2 (Aspose row 1 - zero based) to Excel row 3 (Aspose row 2 - zero based)

the source row (2) ends up with a copy of the shape that is in cell A1, which is incorrect as there are no shapes in the source copy row - row (2) prior to the copy.

Code is:

Workbook sourceWorkbook = new Workbook(@"C:\CopyTest.xlsb");
Worksheet sourceWorksheet = sourceWorkbook.Worksheets[0];
sourceWorksheet.Cells.CopyRows(sourceWorksheet.Cells, 1, 2, 1);
sourceWorksheet.Workbook.Save(@"C:\CopyTestResult.Xlsb", SaveFormat.Xlsb);

Could you throw some light on this for me please and let me know if this is a bug or there is something wrong with my code.

Note, if you change the copy line above to move the source and the destination rows one row down, like this:

sourceWorksheet.Cells.CopyRows(sourceWorksheet.Cells, 2, 3, 1);

then there are not problems. (I suspect because now there are no shapes in the line immediately above the source row in this example).

Many Thanks

Hi,


Aspose.Cells, generally follows MS Excel standards, could you try to do the steps (as per your original codes) manually in MS Excel if works the same way as different way, you select the second row (entirely) and copy it to 3rd row as per your code segment.

If you find MS Excel works differently than Aspose.Cells, please provide us your template Excel file here, we will check your issue soon.

Thank you.

Hi,

Have done the same, both manually and programmatically in MS Excel. Works fine there.

I have attached the template sheet as requested. Also have attached the resultant sheet.

In the resultant sheet you will see the erroneous TextBox Shape in cell A2.

Many Thanks

Hi,

Thanks for your posting and using Aspose.Cells.

We were able to observe this issue with copyrow method as stated by you. We have logged this issue in our database. We will look into it and fix it. Once the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as CELLSNET-41609.

Hi Shakeel,

Just wondering if there is any update on this issue.

Thanks,

Mike

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

We are pleased to let you know that your issue is resolved. We will provide you a fix soon.

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


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