Issues with embedded excel

I have am creating a chart in Excel worksheet and then embedding the workbook containing the chart onto a powerpoint slide. I then save this file onto disk. When I open the file I see "object changed" instead of the embedded excel workbbok. To overcome this problem, I am taking the image of the chart and pasting it on top of the embedded excel.

I have a few issues with the embedded excel.

1) When the chart is double clicked to activate the object, the embeded sheet gets resized.

2) when we move to the chartSheet, we see that the chart is distorted -

i) The Legend box has moved to the left of the chart, while it was set to the right.

ii) The textbox is set to autosize, but the size is not set correctly.

I have attached the sample which I was working on. There is also a sample chart created using the same sample. Please let me know how to make it work correctly.

Dear Mahima,

Thanks for considering Aspose.

First you should know the difference between OLE Object Size and OLE Object Frame size.

OLE Object Size vs OLE Object Frame Size

Having understood it, you will know that you need to set the OLE Object Size not the frame size.

To set OLE Object Size which is an Excel Sheet, there is an API in Aspose.Cells which sets the size of area that should be displayed when sheet is treated as an OLE Object.

The API name is SetOleSize, you can found it as Workbook.setOleSize in Java or Worksheets.SetOleSize in .NET version of Aspose.Cells

For complete code example in .NET and JAVA, please see this thread.

Creating Excel chart and embedding them as OLE Object inside a Presentation

Notice the line

wb.Worksheets.SetOleSize(0, chartRows, 0, chartCols);