Free Support Forum - aspose.com

"Object Changed" with OleObjectFrame in powerpoint


I posted this over on the powerpoint forum, but Alexey over there said my first question was better addressed here. Here was my post:

I've seen the multitude of posts about the "Object Changed" message when you alter an OleObjectFrame in powerpoint. One of the recommended solutions was to use Aspose.Chart to create a chart image and set the PictureId of the OleObjectFrame to the new chart image. Unfortunately, that won't work for us because we are trying to embed an excel worksheet into powerpoint. We want it to look and work just like excel in powerpoint. Which leaves us with 2 questions:

1) Is there anyway to generate a preview image using Aspose.Excel so I can attach it to the powerpoint presentation and set the PictureId to it?

Or

2) Is there anyway to sort of poke the new OleObjectFrame using Aspose.PowerPoint to get rid of the "Object Changed" message? Like when you open it a current presentation and hit open or edit on it, close, save, and reopen you see the worksheet instead of the "Object Changed" message. Is there a way we could sort of automate that process?

1) No. A preview image is not supported. I have some general thoughts to make preview image for data in Excel files, but it's a huge job to make preview image on charts, images, other drawing objects in Excel files.

2) This messaged is caused by changing data in ppt files. Aspose.Excel cannot do anything with it. I had talk about this issue with Alexey but we don't have a solution yet.

This issue has been also a bit of a “showstopper” for my company to adopt Aspose.Excel and Aspose.Powerpoint, hope it’s somehow fixed.

I am not familiar with Powerpoint. Please check http://www.aspose.com/Community/Forums/39332/ShowPost.aspx . You can try to write a macro to remove this “Object Changed” image.

Thanks for the tip, the macro does work, but the problem is that I can’t request all the users of our product to lower their macro security levels to let this macro run during document open.

I posted the Excel macro and thanks to Laurence's new ASPOSE.Excel function the PPT cleans up very nicely. Thanks again Laurence.

But like you my client still wants a one-click solution and does not want to lower their macro security levels. I'm currently looking at this VB.NET code running on my IIS server which fails with the error below when it hits line #2. I've added a COM reference of Microsoft PowerPoint 11.0 Object Library to the project and all of the types below are recognized. I've added the user ASPNET to the Administrators group but still get the error below.

Conceivably this small bit of code should open the PPT on your .NET web server, run a macro to open each of the embedded XLS files and close the PPT with the XLS images displayed.

Laurence, do you have any ideas on configuration items to check?

Thanks Smile [:)]

Dim prsPres As PowerPoint.Presentation
pptApp = New PowerPoint.Application
strTemplateName = "C:\ole_demo\aabb.ppt"
prsPres = pptApp.Presentations.Open(strTemplateName, Microsoft.Office.Core.MsoTriState.msoTrue, Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoFalse)
Dim sArg As String
sArg = "aabb"
prsPres.Application.Run("'C:\ole_demo\" & sArg & ".ppt'!mymac")
prsPres.SaveCopyAs("C:\ole_demo\out-" & sArg & ".ppt")
prsPres.Close()
pptApp.Quit()
GC.Collect()

Server Error in '/office' Application.

Access is denied.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.UnauthorizedAccessException: Access is denied.

ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via , the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET write access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

Source Error:

Line 26:     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Line 27:         Dim prsPres As PowerPoint.Presentation
Line 28:         pptApp = New PowerPoint.Application
Line 29: 
Line 30:         strTemplateName = "C:\ole_demo\aabb.ppt"

Source File: C:\Inetpub\wwwroot\office\WebForm1.aspx.vb Line: 28

Stack Trace:

[UnauthorizedAccessException: Access is denied.]
   office.WebForm1.Button1_Click(Object sender, EventArgs e) in C:\Inetpub\wwwroot\office\WebForm1.aspx.vb:28
   System.Web.UI.WebControls.Button.OnClick(EventArgs e)
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
   System.Web.UI.Page.ProcessRequestMain()


Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032

Do you use MS Office PIA to run the macro?

I think you didn't assign enough rights to access your ppt file in ASP.net applications.

Does it work OK when you run locally, instead of server-side?

One problem regarding this solution (on my scenario) is that as far as I understood the macro would be executed through automation in the server side, and the whole point of using Aspose components is to avoid that.