Adding a COM object from code-behind into a web form

J

John

Hi all,

How do I add a COM object to a web form?

I notice there's a primary interop assembly for Office web components and
what I'm trying to do here is to create a PivotTable object (which is fine)
but then I want to add it to a web page (e.g.
Page.Controls.Add(COMPivotTable)).

I receive the following error message but don't understand what I need to do
to correct this:
"Unable to cast COM object of type
'Microsoft.Office.Interop.Owc11.PivotTableClass' to class type
'System.Web.UI.Control'. Instances of types that represent COM components
cannot be cast to types that do not represent COM components; however they
can be cast to interfaces as long as the underlying COM component supports
QueryInterface calls for the IID of the interface."

Any ideas?

Regards
John.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top