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

Free Support Forum - aspose.com

Ole objects from Excel2007 in PowerPoint 2007


I have tried to run example situated here:

But I have got an error. See stack trace below.

Also I have tried to dowload full example from description, but also got an error:
You can find wrong link “here”:
In the example given below, a Microsoft Excel Chart object in an Excel file is added to a slide as an OLE Object Frame using Aspose.Slides for Java. The Excel file that was used in this example can be downloaded from here.

Full StackTrace:

Exception in thread “main” java.lang.NullPointerException
at com.aspose.slides.pptx.OleObjectFrameEx.(SourceFile:117)
at com.aspose.slides.pptx.ShapesEx$3$3.do(SourceFile:135)
at com.aspose.slides.obfuscated.as.if(SourceFile:36)
at com.aspose.slides.obfuscated.as.(SourceFile:20)
at com.aspose.slides.pptx.ShapesEx$3.do(SourceFile:123)
at com.aspose.slides.obfuscated.as.if(SourceFile:36)
at com.aspose.slides.obfuscated.as.(SourceFile:20)
at com.aspose.slides.pptx.ShapesEx.if(SourceFile:110)
at com.aspose.slides.pptx.ShapesEx.do(SourceFile:241)
at com.aspose.slides.pptx.ShapesEx.addOleObjectFrame(SourceFile:273)
at TestAsposePowerPoint2007.addPictureOle(TestAsposePowerPoint2007.java:83)

Line 83: OleObjectFrameEx oof = sld.getShapes().addOleObjectFrame( 0, 0, pres.getSlideSize().getSize().width,
“Excel.Sheet.8”, buf )

Please give me working example.

Actulay I need generate chart in excel 2007 from scratch, and insert into PowerPoint 2007 as Ole object.

Thank you.

Hi Alexander,

Please use the code snippet given below to add the Xlsx file Ole frame inside PPTX. Please share, if I may help you further in this regard. For reference, I have shared the sample excel file along with generated presentation.

//Instantiate PrseetationEx class that represents the PPTX
PresentationEx pres = new PresentationEx();

//Access the first slide
SlideEx sld = pres.getSlides().get(0);

//Load an Excel file to Array of Bytes
File file=new File(“D:\Aspose Data\Roadmap.xlsx”);
int length=(int)file.length();
FileInputStream fstro = new FileInputStream(file);
byte[] buf = new byte[length];
fstro.read(buf, 0, length);

//Add an Ole Object Frame shape
OleObjectFrameEx oof = sld.getShapes().addOleObjectFrame(0, 0, pres.getSlideSize().getSize().width, pres.getSlideSize().getSize().height, “Excel.Sheet.12”, buf);

//Write the PPTX to disk
pres.write(“D:\Aspose Data\OleEmbed.pptx”);

Many Thanks,


I got the same exception.

Maybe it is due to latest library?

I’m using at the moment: aspose.slides-


Yes, reason in library , in new one aspose.slides- your example works fine.
Thank you.