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

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top