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

Discussion in 'ASP .Net' started by John, Nov 30, 2005.

  1. John

    John Guest

    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.
     
    John, Nov 30, 2005
    #1
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ben Miller [msft]

    Re: Code Behind vs. no code behind: error

    Ben Miller [msft], Jun 27, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    843
    Alphonse Giambrone
    Jun 28, 2003
  2. Daniel Manes

    Code-Behind Pain in the Behind!

    Daniel Manes, Jun 10, 2005, in forum: ASP .Net
    Replies:
    11
    Views:
    958
  3. teliot
    Replies:
    7
    Views:
    12,526
    Alan Silver
    Nov 30, 2005
  4. John
    Replies:
    1
    Views:
    2,602
    Ken Cox
    Dec 1, 2005
  5. Replies:
    2
    Views:
    4,128
  6. Rob R. Ainscough
    Replies:
    2
    Views:
    6,812
    Rob R. Ainscough
    Apr 4, 2006
  7. BillE
    Replies:
    1
    Views:
    358
    Mark Fitzpatrick
    Oct 4, 2006
  8. John

    Non-code behind to code behind

    John, Feb 19, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    733
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Feb 19, 2007
Loading...