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

Free Support Forum - aspose.com

Embedding multiple charts in same excel file to different OLE objects into PowerPoint presentation


I have one doubt regarding creating charts in Excel and embedding them in PowerPoint.

Is it possible to create multiple charts in single excel file(in separate sheets) and embed them in powerpoint(as different OLE objects per chart)?
Or do we need to create separate excel files per chart?

How can we instruct PowerPoint to open a particular chart/sheet in the embedded excel when we click on chart image?
I mean when we click on Chart1, I want to open the worksheet which has Chart1 and when we click on Chart2, I want to open Chart2 sheet. Is it possible?

In short, ABC.xls contains 3 sheets(named ChartSheet1, ChartSheet2, ChartSheet3) having charts. I want to add 3 slides in to XYZ.ppt, where in first slide, I want to embed one chart from ChartSheet1, second slide OLE object should point to chart in ChartSheet2, and so on.



I would suggest you to visit this link Creating Excel Chart and Embedding it in Presentation as OLE Object which contains information on how to create a chart in excel worksheet and embed it into PowerPoint slide. Actually the article and code explains how to create one excel worksheet with data and other worksheet with chart (based over data provided in previous worksheet). As per your requirement, you are interested in creating three worksheets with charts and want each of them to be added over separate slide of presentation, I think it can easily be accomplished while calling the two methods AddExcelChartInWorkbook(...) and AddExcelChartInPresentation(...) three times.

If you don't want to add the worksheet with data, you can comment out the code of sheet addition from AddExcelChartInWorkbook(...) method. The only thing that you need to change in code is to add another argument to AddExcelChartInWorkbook(....) which must take the worksheet name as argument. Because, in the provided code, worksheet name is a constant value and Aspose.Cells does not allow creation of multiple sheets with the same name. If you don't want to add an extra argument, you can also define some procedure that can set a unique name for each worksheet.

In my case, I have successfully been able to add two chart sheets in workbook and add them as OLE object over two identical presentation slides. I hope it can resolve your problem.