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

Free Support Forum - aspose.com

Cannot add Excel file as OLE object

Adding the attached file to a presentation using the sample code in the first example (link below) does not produce any compile-time or run-time errors.

But once you open the generated .ppt file in powerpoint (Office 2003) and click on the Object Changed message, you get an error message.

http://www.aspose.com/documentation/file-format-components/aspose.slides-for-.net-and-java/working-with-ole-object-frames.html

Dear larsxe,

Thanks for reporting.

We will investigate and provide you a solution as soon as possible.

Dear larsxe.

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

I found out there is some problem with your source Excel sheet. I saved it back using File -- > Save As … menu command in MS Excel 2002.

Then I inserted it with the follow code and it did not show the message on double clicking the Object Changed image, which it was giving earlier.

Please see the generated ppt and source excel sheet in the attachment.

C#

-----------------------------------------------------------------------

//Instantiate a Presentation object that represents a PPT file

Presentation pres = new Presentation();

//Accessing a slide using its slide position

Slide slide = pres.GetSlideByPosition(1);

//Reading excel chart from the excel file and save as an array of bytes

FileStream fin = new FileStream(@"c:\-workbook1.xls", FileMode.Open, FileAccess.Read);

byte[] xlSheetData = new byte[fin.Length];

fin.Read(xlSheetData, 0, (int)fin.Length);

//Inserting the excel chart as new OleObjectFrame to a slide

OleObjectFrame oof = slide.Shapes.AddOleObjectFrame(0, 0, pres.SlideSize.Width,

pres.SlideSize.Height, "Excel.Sheet.8", xlSheetData);

//Writing the presentation as a PPT file

pres.Write("C:\\output.ppt");