Slides and Cells - Powerpoint Template contains Excel - BIFF7 Error

I have a powerpoint template that has an embedded Excel Worksheet. When I try to access the worksheet object I get the error "This Excel files contains BIFF7(Excel95 or earlier file format) records."

I clicked on the excel object in the template and converted it to Excel 97-2003 but that did not seem to change anything. (still get the error) Any ideas on how to correct this? Am I reading the template incorrectly? (I am new to Aspose)

Here is my code to read the object:

Dim oOLEFormat As Aspose.Slides.OleObjectFrame

Dim oWorksheet As Aspose.Cells.Worksheet

oOLEFormat = oShapes(43)

Dim ExcelObj As OleObjectFrame = oOLEFormat

Dim ms As New MemoryStream(ExcelObj.ObjectData)

Dim oWorkbook As New Aspose.Cells.Workbook

oWorkbook.Open(ms)

Hi,

Can you please provide the ppt template for investigation?

Here is the template I am using. (MS Powerpoint 97-2003).

Hi,

Please use the template attached instead as it is embedded valid 97-2003 excel.

Can you tell me how to make this change myself, so I can do so on our other templates?

Hi,

Just right click the embedded excel object and select 'worksheet object' - 'open' option to open it in separate window and then save it as '97-2003' format and then re-embed the updated format to the ppt.

Thank you that works.

Now I just have to get around the Worksheet resizing issue. I have seen some mention of it on the boards but have yet to see a solution that works for me. I used the get a picture of the worksheet and replace the Object Changed picture with that to get around that. Like many Aspose users the point is that my end user does not have to open the presentation and change anything.

Hi,

The resize issue is expected to resolve in the next release. The respective issue id is 11051 and you will be informed as soon as it is resolved.

Hi Eileen,

Thanks for the patience.

We now have a solution to the resizing of the Excel Workbook embedded as OLE Object in the PowerPoint Slides. Please visit this technical article from our online documentation explaining the solution to the resizing issue.

Many Thanks

Can someone add some clarification on this? Maybe I am missing something, but I can't figure out where the code in the tech. article should go.

Right now in my code I grab the Excel object from the template - change the values in the cells - then take a picture and attach the picture to the object.

So before I change the cells I have the following code:

Dim oWorkbook As New Aspose.Cells.Workbook

Dim oWorksheet As Aspose.Cells.Worksheet

Dim excelObj As OleObjectFrame = oSlide.Shapes.Item(0)

Dim ms As New MemoryStream(excelobj.ObjectData)

oWorkbook.Open(ms)

oWorksheet = oWorkbook.Worksheets(0)

in here put values into cells (lots of oworksheet.cells("B#").PutValue("") statements)

Then at the end I have the following:

Dim msOut As New MemoryStream

oWorkbook.Save(msOut, FileFormatType.Excel2003)

excelObj.ObjectData = msOut.ToArray()

Dim img As Bitmap = oWorksheet.SheetToImage

Dim pic As Aspose.Slides.Picture = New Aspose.Slides.Picture(Pres, img)

Dim imgID As Int16 = Pres.Pictures.Add(pic)

excelObj.PictureId = imgID

Should I get the size of the worksheet at the beginning and then before I get the image, use that size in updating the excelObject?

The sample code seems to create a new object on the slide, I don't need a new object, I need to set the size of the existing object.

Dear Eileen,

Actually, the idea behind the approach used is Embedded OLE Object Window size should be the same as that of the OLE Object Frame in the PowerPoint Slide. So, we can take either of them and set the size of remaining with that of selected one. In your approach, you can set some size of the worksheet and use that same size to modify the size of existing Ole Obejct frame in presentation and then add image.

Thanks and Regards,

This is not working for me. Still would rather have the actual worksheet visible and the right size but even with the image replacing the Object Changed, it is not working.

I am wondering if it is because I already have an OLEObjectFrame and that frame is the correct size but the image on the frame is not.

I start out getting the Excel object from the template:

Dim excelObj As OleObjectFrame = oSlide.Shapes.Item(0)

Dim ms As New MemoryStream(excelobj.ObjectData)

At this point the frame and the worksheet are the correct size.

I do a bunch of putvalues on cells.. then

Dim msOut As New MemoryStream

oWorkbook.Save(msOut, FileFormatType.Excel2003)

excelObj.ObjectData = msOut.ToArray()

Dim img As Bitmap = oWorksheet.SheetToImage

Dim pic As Aspose.Slides.Picture = New Aspose.Slides.Picture(Pres, img)

Dim imgID As Int16 = Pres.Pictures.Add(pic)

excelObj.PictureId = imgID

Here excelObj has the correct size put img is small.

?excelobj.Width

5447

?excelobj.Height

1431

?img.Width

1161

?img.Height

434

I see in the ASPOSE documentation that SheetToImage is discontinued, would newer versions solve this problem? I can try and lobby for an upgrade if I have justification.

Hello Dear,

We are working on the issue specified by you and will share the information with you ASAP. We appreciate your patience for that.

Thanks and Regards,

Hi Eileen,

Thanks for your feedback regarding the resizing issue.

We have tested the solution as explained in the article with the following versions:

Aspose.Cells for .NET 5.1.2
Aspose.Slides for .NET 4.3.0

Please find attached a sample application for the demonstration. The input template (input.ppt) and the resulting output presentation (output.ppt) are also available in bin\debug directory in addition to the above versions of Aspose.Cells and Aspose.Slides.

Hopefully this will give you an idea about the solution. In case, you still have confusions about the solution, don’t forget to share with us.

Many Thanks

I can not run the sample you attached. As I have said I can not load any Aspose software except Aspose.Cells 4.7.1 and Aspose.Slides 2.9.2 and apparently your example does not even compile with those versions.

So are you telling me that the fix for the resizing will not work for the versions of Aspose software that I am currenty permitted to use? If this is the case please clearly state this so that I may take that message to management and get more recent versions approved.

Hello Dear,

The case that you have explained that you need to update the existing Ole frame, does not seem to work with the work around shared in article. I may share the work around with you that you may please replace the existing Ole frame by new one but preserving the existing and position of older frame and applying that on new frame. Thus deleting the older frame.

Thanks and Regards,