worksheet.Shapes.AddCopy with OleObject as parameter adds incorrect object


#1

Hi

I get Shape objects from one worksheet and put it into another worksheet using worksheet.Shapes.AddCopy(shape, shape.UpperLeftRow, shape.Top, shape.UpperLeftColumn,shape.Left);

In case when shape is OleObject with reference to Word file this method works without error. But when I try to open destination worksheet using MS Excel I get error dialog “We found a problem with some content in “filename.xls”…”. If I recover it OleObject is removed.

This issue is observed in Aspose.Cells v.19.10 and v.18.6. Below is a runnable code that reproduces this issue. Please find sample solution project and original xlsx file in attachment

using Aspose.Cells;

namespace AsposeOleObject
{
class Program
{
static void Main(string[] args)
{
var originalWorksheet = new Workbook(“C:\original.xlsx”, new LoadOptions()).Worksheets[0];
var workbook = new Workbook(FileFormatType.Xlsx);
var destinationworksheet = workbook.Worksheets.Add(“TestSheet”);
var shape = originalWorksheet.Shapes[0];
destinationworksheet.Shapes.AddCopy(shape, shape.UpperLeftRow, shape.Top, shape.UpperLeftColumn,shape.Left);
workbook.Save(“C:\destination.xlsx”);
}
}
}

OleObjectError.zip (236.2 KB)

Best Regards
Andriy


#2

@workshare,
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

CELLSNETCORE-39 – Worksheet.Shapes.AddCopy with OleObject as parameter adds incorrect object


#3

@ahsaniqbalsidiqui
Thank you for an answer. I am looking forward to hearing from you any updates
Best Regards
Andriy


#4

@workshare,

We are working on your issue and we will try to figure out your issue soon.

Once we have any new information available, we will let you know.


#5

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


#6

@workshare,
Please try our latest version/fix: Aspose.Cells v19.10.4:
Aspose.Cells19.10.4 For .NetStandard20.Zip (4.1 MB)

Your issue should be fixed in it.

Let us know your feedback.


#7

@ahsaniqbalsidiqui
Hi, thanks! Will try and come back to you with a result


#8

@andrryaka,

Please take your time to evaluate the new fix. Hopefully it will sort out your issue.