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

Free Support Forum - aspose.com

Presentation pictures add

I have updated a c# .net web project/solution with the new aspose dll for slides and the old code needs to be translated to the new apis in a whole lot of places. the last bit of code I need to get through is listed below. the problem lines are highlighted in red. it would be greatly appreciated if someone could lend a hand. Thanks.

chartoof is an OleObjectFrame object. They no longer have a PictureID definition.

pres is a presentation object. They no longer have a definition for Pictures.

wd is a Aspose.Cells.WorkbookDesigner object.


wd.Workbook.Worksheets.SetOleSize(1, 1, 1, 1);
MemoryStream pic = new MemoryStream();
pic.Position = 0;
int graphPicID = pres.Pictures.Add(new Picture(pres, pic));
chartoof.ObjectData = wd.Workbook.SaveToStream().ToArray();
chartoof.PictureId = graphPicID;

Hi Robert,

Please update your code as per the code segment shared below and in case you still face any issue, please share your complete sample code with us to further check the issue.

MemoryStream pic = new MemoryStream();

wd.Workbook.Worksheets[0].Charts[0].ToImage(pic, System.Drawing.Imaging.ImageFormat.Png);

pic.Position = 0;

IPPImage image = pres.Images.AddImage(pic);


oof.SubstitutePictureFormat.Picture.Image = image;

Thanks & Regards,

thanks owais.ahmad for your quick response

unfortunately it didn't quite work completely. while it did display the table data on the chart it all disappeared once the file was converted from ppt to pptx. if anyone is following along on this thread, the code below did work all the way through the convert and save process...

//MemoryStream pic = new MemoryStream();

//wd.Workbook.Worksheets[0].Charts[0].ToImage(pic, System.Drawing.Imaging.ImageFormat.Png);

//pic.Position = 0;

//int graphPicID = pres.Pictures.Add(new Picture(pres, pic));

System.Drawing.Bitmap imgChart = wd.Workbook.Worksheets[0].Charts[0].ToImage();

chartoof.SubstitutePictureFormat.Picture.Image = pres.Images.AddImage((System.Drawing.Image)imgChart);


chartoof.ObjectData = wd.Workbook.SaveToStream().ToArray();

//chartoof.PictureId = graphID;

Hi Robert,

Thank you for the feedback.

I am glad to notice that your issue has been resolved. However, please share the complete sample code which you use that is still causing the problem when converting from PPT to PPTX. We will check it and see why the issue occurs.

Thanks & Regards,