Aspose.Slides IOleObjectFrame issue

Hi, i’m trying to access OleObjectFrame (Excel worksheet) in a template and update ObjectData to populate new set of information from database. This does not seem to be working as i still see placeholder data in the created pptx file. However, when i click edit on the shape, its getting replaced with the data that was populated programatically from the database. How do i make sure that i see correct shape without having to click edit after pptx file is created?


if (ole != null)
{
//test data
double[] wbRows = { 0, 65, 35, 75, 23 };
double[] wbColumns = { 10, 30, 23, 15, 26, 27, 53, 30 };

int wbRowCount = wbRows.Count();
int wbColCount = wbColumns.Count();

//Reading object data in Workbook
Aspose.Cells.Workbook Wb;
using (System.IO.MemoryStream msout = new System.IO.MemoryStream())
{
Wb = new Aspose.Cells.Workbook();

for (int r = 0; r < wbRowCount; r++)
{
for (int c = 0; c < wbColCount; c++)
{
Wb.Worksheets[0].Cells[r,c].PutValue(wbRows[r]);
}
}

ole.ObjectProgId = “Excel.Sheet.12”;
ole.ObjectName = “Worksheet”;

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

Wb.Save(msout, so1);

//Changing Ole frame object data
msout.Position = 0;
ole.ObjectData = null;
ole.ObjectData = msout.ToArray();
ole.UpdateAutomatic = true;
}
}

Hi Aravind,

I have observed your requirements and it seems that you are probably dealing with an issue that you update the excel sheet data but it is not getting depicted in ole frame inside Aspose.Slides. I like to share that this is infact not an issue with Aspose.Slides. Whenever, you add or update the ole frame data it is in disabled form. You need to either double click the ole frame to get the updated image of Ole frame data in slides or you can generate the image of updated worksheet and then set that as Ole frame image inside slide. In this way you will get the updated image. The other option is to use the third party macros to enable the Ole frames whenever presentation gets loaded in PowerPoint. This way, whenever you will load the presentation, you will get updated view of Ole data. You can employ any of two suggested approaches. Please visit the following documentation links to serve the purpose in this regard.

Updating OLE objects automatically using MS PowerPoint Add In|Aspose.Slides Documentation
Creating Excel Chart and Embedding it in Presentation as OLE Object|Aspose.Slides Documentation

Many Thanks,

Thank you very much for your time. The suggestion to “…generate the image of updated worksheet and then set that as Ole frame image inside slide” worked fine.

Hi Aravind,

Thank you for sharing the feedback. Its good to know that suggested approach helped to serve the purpose on your end.

Many Thanks,