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

Free Support Forum - aspose.com

How to attach image to slide in pptx

Hi, I have the following code:

////////////////////////////////////////////
com.aspose.slides.Picture pic = new com.aspose.slides.pptx.PictureEx(pres, new ByteArrayInputStream(imgChart));
int picId = pres.getPictures().add(pic);
int slideWidth = (int) pres.getSlideSize().getX();
int slideHeight = (int) pres.getSlideSize().getY();
OleObjectFrame oof = sld.getShapes().addOleObjectFrame(slideWidth / 2, chartProperties.getLeftOffset(),
slideWidth / 2 - chartProperties.getSlideWidthDiff(), slideHeight - chartProperties.getSlideHeightDiff(),
“Excel.Sheet.8”, wbArray);
oof.setPictureId(picId);
/////////////////////////////////////////////////

I have not found equivalent functions in PPTX. How to do that?

Hi Leonid,


Please visit this documentation link and look for method AddExcelChartInPresentation. You will find the code snippet for adding the image inside slide.

Many Thanks,