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

Free Support Forum - aspose.com

Modifying the OleObject frame which is an embed excel chart is not reflected in the presentation when saved


I have a PPT presentation with an embedded graph from Excel. When programatically modifying the cells that the chart is based on add then saving it as different presentation, the new presentation looks exactly the same. I am using the trail version of Aspose Total for .Net. Below is the code that I’m using:

private void generateDRGChangeGraph(Presentation ppt)
ISlide slide = ppt.Slides[0];

OleObjectFrame oleObjectFrame = null;

// Traversing all shapes for oleObjectFrame frame
foreach (IShape shape in slide.Shapes)
if (shape is OleObjectFrame)
oleObjectFrame = (OleObjectFrame)shape;

if (oleObjectFrame != null)
// Reading object data in Workbook
Aspose.Cells.Workbook Wb;

using (System.IO.MemoryStream msln = new System.IO.MemoryStream(oleObjectFrame.ObjectData))
Wb = new Aspose.Cells.Workbook(msln);
using (System.IO.MemoryStream msout = new System.IO.MemoryStream())
// Modifying the workbook data
Wb.Worksheets[7].Cells[5, 2].PutValue(1);
Wb.Worksheets[7].Cells[6, 2].PutValue(0.5);
Wb.Worksheets[7].Cells[7, 2].PutValue(0.25);
Wb.Worksheets[7].Cells[8, 2].PutValue(0.75);

Aspose.Cells.OoxmlSaveOptions so1 = new Aspose.Cells.OoxmlSaveOptions(Aspose.Cells.SaveFormat.Xlsx);

Wb.Save(msout, so1);

// Changing Ole frame object data
msout.Position = 0;
oleObjectFrame.ObjectData = msout.ToArray();

// Write the presentation as a PPTX file
ppt.Save(@"…\Reporting\ReportingTemplates\OleEdit_out.pptx", SaveFormat.Pptx);

Hi Ryan,

I have observed the code sample shared by you and like to share that in your code you are updating the Ole frame but not updating the image of Ole frame for modified excel sheet. I request you to please observe the sample code given over this documentation link where by you will find sample code for generating the excel sheet image using Aspose.Cell and then setting that image as Ole frame image. The other approach is to use any third party macros in your presentation that can auto enable the Ole frames whenever the presentation is loaded. This way you will always get updated image of excel sheet in Ole frame inside presentation.

Many Thanks,