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

Free Support Forum - aspose.com

Opening a Slide Show Embedded in a Word Document


I need to open and read a slide embedded in a word document. I thought that this would be the proper scheme, but it fails to open the slide.

What would br the correct object to try to open the OLE slide as?

public IEmbeddedDocument ReadOLE( Aspose.Words.Drawing.OleFormat OLE)




string OLE_type = ShortProgId( OLE.ProgId ) ;

System.IO.MemoryStream embedded_doc_stream = new System.IO.MemoryStream();

OLE.Save( embedded_doc_stream ) ;

switch ( OLE_type )


case “Word.Document” :

EmbeddedWordDocument word_doc = new EmbeddedWordDocument( new Aspose.Words.Document( embedded_doc_stream ) );

return word_doc ;

//break ;

case “Excel.Sheet” :

Aspose.Cells.Workbook asp_workbook = new Aspose.Cells.Workbook();


EmbeddedExcelDocument excel_doc = new EmbeddedExcelDocument(asp_workbook);

return excel_doc;

case “PowerPoint.Show”:

EmbeddedPowerPointPresentation presentation = new EmbeddedPowerPointPresentation(new Aspose.Slides.Presentation( embedded_doc_stream));

return presentation;

default :

return null ;





return null;


Dear yrona,

Thanks for considering Aspose.Slides.

What is EmbeddedPowerPointPresentation? Is it some Automation API? Actually, its constructor does not expect the Aspose.Slides.Presentation as a parameter.

However, if you could read OLE object data as stream, then you can create the Aspose.Slides.Presentation object from that stream and also write it back to stream.


Aspose.Slides.Presentation pres=new Presentation(stream);

//to write it back in stream


Here is the proper code that reads/write presentation into stream.


//Create a presentation object from scratch, you can also create it from existing ppt file

Presentation srcPres = new Presentation();

//Write the presentation into output stream

FileStream fout = new FileStream("c:\\tempOut.ppt", FileMode.Create);



//Read the presentation from input stream

FileStream fin = new FileStream("c:\\tempOut.ppt", FileMode.Open);

srcPres = new Presentation(fin);


//Write the presentation into memory stream

MemoryStream ms = new MemoryStream();


//Read the presentation from memory stream

ms.Position = 0;

srcPres = new Presentation(ms);

//Write the final presentation on disk


EmbeddedPowerPointPresentation isa a wrapper wrapping an Aspose.Slides.Presentation object.

Thanks very much. You cleared up my problem. You have to return the stream position to 0 prior to passing it to the Presentation Constructor.

It appears that the other constructors (Aspose.Word.Document, Aspose.Cells.Workbook) do this for you, which is what lulled me into a false sense of security.

Thanks so much!