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

Free Support Forum - aspose.com

Error on showing two pictures in a slide (Aspose.Slides 2007)

Hi Aspose

I am trying to show two images on a single slide using below code. but the second image is not coming , it is throwing error for the secong image (Please refer attached image here).

//Create new SlideEx


string tempFile = Path.GetTempFileName();

ChartExpt.Width = Unit.Pixel(600);

ChartExpt.Height = Unit.Pixel(500);

ChartExpt.Save(tempFile, ChartImageFormat.Png);

string tempFile2 = Path.GetTempFileName();

chtsecExport.Width = Unit.Pixel(600);

chtsecExport.Height = Unit.Pixel(500);

chtsecExport.Save(tempFile2, ChartImageFormat.Png);

//Get SlideEx position

SlideEx NewSlide = Present.Slides[Present.Slides.Count - 1];

ShapeEx shapeEx = FindShape(NewSlide, "ParentChart");

shapeEx.FillFormat.FillType = FillTypeEx.Picture;

shapeEx.FillFormat.PictureFillFormat.PictureFillMode = PictureFillModeEx.Stretch;

System.Drawing.Image img = (System.Drawing.Image)new Bitmap(tempFile);

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

shapeEx.FillFormat.PictureFillFormat.Picture.Image = imgx;

//Get SlideEx position

//NewSlide = Present.Slides[Present.Slides.Count - 1];

ShapeEx shapeEx2 = FindShape(NewSlide, "ChildChart");

shapeEx2.FillFormat.FillType = FillTypeEx.Picture;

shapeEx2.FillFormat.PictureFillFormat.PictureFillMode = PictureFillModeEx.Stretch;

System.Drawing.Image img2 = (System.Drawing.Image)new Bitmap(tempFile2);

ImageEx imgx2 = Present.Images.AddImage(img2);

shapeEx.FillFormat.PictureFillFormat.Picture.Image = imgx2;

Version which i am using is Aspose.Slides 2007 Evaluation version.To see the error please refer attached image file here.

Please reply ASAP.


Waiting for reply


Hi Binod,

Thanks for your interest in Aspose.Slides.

I have been able to reproduce the issue of showing multiple images on same slide and it seems to be an inconsistency in Aspose.Slides. An issue with ID 16883 has been created in our issue tracking system to resolve the issue. This thread has also been linked with the issue so that you may be automatically notified, once the issue is resolved.

Thanks and Regards,

Hello Binod,

There is wrong line in your code. I marked it with red color. There should be shapeEx2 variable.