views:

980

answers:

2

I'm working on a project that requires me to load an OLE object and render it in a .NET WinForm app (C#). Unlike VB6 .NET has no built in OLE container, and the recomended approach is to use the WebBrowser control which supports displaying ActiveX content. The issue I have is the provider of the OLE object in question does not have an ActiveX control available.

Simply put is there any way to load an OLE object onto a WebForm? Or will I need to write an ActiveX control that loads the OLE Object? If the latter, does anyone have an example of this, or recommended reading material?

cheers,

Marc.

+1  A: 

It has a wrapper for ActiveX controls, AxHost. But if you mean OLE Linking and Embedding, no, that's dead technology. It used to be possible with DsoFramer but that has been removed from the MSFT download site due to serious Office compatibility problems. You might be able to dig up a copy somewhere. Long term, you should avoid this, OLE has no future.

Hans Passant
Hi nobugz, thanks for your reply. As with most technology, they tend to out live their desired lifetime. In our case for the short to medium future we need to get the OLE object rendered in a standard windows form (paint to a canvas essentially). Long term we'll be working on a better approach that will not require the software to be installed (therefore not relying on the OLE object).
Marc
Is there an alternative to OLE? Even a simpler alternative, which doesn't allow in-place editing nor an in-place live/active view of the object, but which lets you get (from the application which created the object) a static image of the object which you can embed in your document?
ChrisW
A: 

There's an alternative mechanism suggested at Visual Studio 2005 and Visual Studio .NET do not provide an OLE container control for Windows Forms and How to use the WebBrowser control to open Office documents in Visual C# 2005 or in Visual C# .NET.

ChrisW
Hi Chris, That is correct, you can use the WebBrowser control to render any ActiveX control to mimic the old OLE container model. Unfortunately the document type I wish to render does not yet have an ActiveX control (like say Office). My idea was to see if in ActiveX I could write/use an OLE container to render the document, then in managed code use the WebBrowser control to load the ActiveX object. Thanks for the suggestion though!Cheers,Marc.
Marc