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

Free Support Forum - aspose.com

Adding image to smart art

Is there a way to add image to smart art in powerpoint through aspos slides?

Hi,


Thanks for your interest in Aspose.Slides.

I have observed the requirement shared by you and like to sggest you to try using following code to serve the purpsoe. However, I am getting Argument exception while setting smart art fill type to Picture. I have created a ticket with ID SLIDESNET-34485 in our issue tracking system to further investigate and resolve the issue. Once the issue will be resolved, you will be using following sample code to serve the purpose.

public static void addSmartArtImage()
{
//Instantiate the presentation
PresentationEx pres = new PresentationEx();

//Access the presentation slide
SlideEx slide = pres.Slides[0];

//Instantiate the ImageEx class
System.Drawing.Image img = (System.Drawing.Image)new Bitmap(@“C:\Users\Public\Pictures\Sample Pictures\Desert.jpg”);

ImageEx imgx = pres.Images.AddImage(img);

//Add Smart Art Shape
SmartArtEx smart = slide.Shapes.AddSmartArt(0, 0, 400, 400, SmartArtLayoutTypeEx.BasicBlockList);

smart.FillFormat.FillType = FillTypeEx.Picture;
smart.FillFormat.PictureFillFormat.Picture.Image = imgx;
//Saving presentation
pres.Save(“D\Aspose Data\SimpleSmartArt.pptx”, Aspose.Slides.Export.SaveFormat.Pptx);

}


Many Thanks,