This method used to work when I used Aspose.Slides but now that I am using Aspose.Slides.Pptx it doesn’t work anymore. Can you tell me how I can perform the same task using the new API please.
Well, I actually just saw that you guys had another release today for Aspose Total, so I got latest Dlls and my biggest issue compiling right now are here. Please tell me which reference I am missing for Aspose.cell that is causing all the problems right now.
private Aspose.Words.Drawing.Shape ConvertPictureToShape(Aspose.Cells.Picture excelPicture, Document doc){//Create new ShapeAspose.Words.Drawing.Shape wordsShape = new Aspose.Words.Drawing.Shape(doc, Aspose.Words.Drawing.ShapeType.Image);//Set imagewordsShape.ImageData.SetImage(excelPicture.Data);//Import Picture properties inhereted from ShapeImportShapeProperties(wordsShape, (Shape)excelPicture);return wordsShape;}
Hi Daniel,
I have generated the requested code snippet that works for PPTX. Please use the code snippet given below for your application and share with us if you encounter any issue. There is similar video tutorial developed for modifying the chart image and data using Aspose.Slides for Java here and it may be used as reference.
public static void ReplaceShapeExObjectData(Aspose.Slides.Pptx .ShapeEx shape, Workbook wb)
{
if (shape is OleObjectFrameEx)
{
// Replace the values in the argument shape's worksheet with the updated values.
OleObjectFrameEx shapeOOF = shape as OleObjectFrameEx;
shapeOOF.ObjectData = wb.SaveToStream().GetBuffer();
// get the first sheet as an image so we can replace the "object modified" image
Bitmap sheetBitmap = null;
try
{
sheetBitmap = GetBitmap(wb);
}
catch
{
sheetBitmap = null;
}
if (sheetBitmap != null)
{
// Replace the image for the worksheet in the presentation
PresentationEx pres = shape.Parent.Parent;
//Instantiate the ImageEx class
System.Drawing.Image img = (System.Drawing.Image)sheetBitmap;
ImageEx imgx = pres.Images.AddImage(img);
shapeOOF.FillFormat.PictureFillFormat.Picture.Image = imgx;
//or
//shapeOOF.Image = imgx;
}
}
}
Thanks and Regards,
thanks, I’ll try this new method when upgrading Aspose.Slides. However, any help with the Aspose.Cells errors I listed as well? I went from 4.8 to the newest version of Aspose.Cells and that’s why I am getting the errors now. Any idea why?
private Aspose.Words.Drawing.Shape ConvertPictureToShape(Aspose.Cells.Picture excelPicture, Document doc){//Create new ShapeAspose.Words.Drawing.Shape wordsShape = new Aspose.Words.Drawing.Shape(doc, Aspose.Words.Drawing.ShapeType.Image);//Set imagewordsShape.ImageData.SetImage(excelPicture.Data);//Import Picture properties inhereted from ShapeImportShapeProperties(wordsShape, (Shape)excelPicture);return wordsShape;}