From OLE.ObjectData to WorkBook : Chart is lost

Hi,

I have a Powerpoint presentation, its first slide with an OLE shape, showing a chart (the OLE is an Excel WorkBook containing one sheet with data and one sheet with the corresponding chart).

Now I get a MemoryStream from this OLE through ObjectData byte table, and loads a new WorkBook object with it.

When I save my WorkBook, every sheet and data is there... except the chart !

Is there a reason for that ?

Please see sample enclosed.

Thank you.

Yann BICREL - Infocubed France

Hi,

Thanks for providing us the template project.

Yes, there is a reason for loosing your chart in the generated excel file. You need to use Workbook.Open method instead of Workbook.LoadData() method. For your information, when you use Workbook.LoadData method, all the drawing objects, shapes, formattings etc are lost, only data would be retrieved.

So, kindly change/update your code to:

Workbook Book = new Workbook();
Book.Open(ms)


Thank you and have a good day!

Thank you very much for your quick reply, as usual !

I will try your solution.

Regards,

Yann