We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Using Range.Copy after Range.CopyData corrupts the workbook

Hello,

I’ve been getting corrupt workbooks after trying to use Range.Copy with PasteType.All after a Range.CopyData for some specific content.
I’ve attached the two workbooks and sample code that reproduces the issue:

        Aspose.Cells.Workbook Source = new Workbook("C:\\_Test\\Source.xlsx");
        Aspose.Cells.Workbook Destination = new Workbook("C:\\_Test\\Destination.xlsx");
        Aspose.Cells.Range sourceRange = Source.Worksheets.GetRangeByName("Range1");
        Aspose.Cells.Worksheet targetSheet = Destination.Worksheets[0];
        Aspose.Cells.Range destinationRange = targetSheet.Cells.CreateRange(3, 25, sourceRange.RowCount, sourceRange.ColumnCount);
        destinationRange.CopyData(sourceRange);
        destinationRange.Copy(sourceRange, new PasteOptions { SkipBlanks = false, PasteType = PasteType.All });
        Destination.Save("C:\\_Test\\Result.xlsx");

Test.zip (23.0 KB)

@adrian.anton,
We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSNET-46671 - Range.Copy after Range.CopyData corrupts the workbook

@adrian.anton,

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

The issues you have found earlier (filed as CELLSNET-46671) have been fixed in Aspose.Cells for .NET v19.4. This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi