Results 1 to 10 of 10

Thread: Ole objects in Qt(MS OFFice)

  1. #1
    Join Date
    Sep 2007
    Location
    Szczecin, Poland
    Posts
    153
    Thanks
    7
    Thanked 11 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Ole objects in Qt(MS OFFice)

    Hi,
    I know how to use QAxObject with automation objects to access MS Office files, but there's no ActiveX controls that would be able to show Office documents embedded in my application. I found that OLE containers are supposed to embeed documents in a way that allows to edit them with original(server) application, but unfortunately activeQt framework doesn't support OLE objects.
    Does anybody knows is it possible to embed OLE object in Qt application?
    I heard that it is possible to write an activeX control in MFC(that supports OLE objects) and embed it in QAxWidget, but I don't know MFC so maybe there's other similar way to do it.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Ole objects in Qt(MS OFFice)

    Quote Originally Posted by mchara View Post
    I know how to use QAxObject with automation objects to access MS Office files, but there's no ActiveX controls that would be able to show Office documents embedded in my application.
    Really? What's wrong with QAxWidget?

    I found that OLE containers are supposed to embeed documents in a way that allows to edit them with original(server) application, but unfortunately activeQt framework doesn't support OLE objects.
    Sure it does. Take a look at ActiveX examples that come with Qt.

    I heard that it is possible to write an activeX control in MFC(that supports OLE objects) and embed it in QAxWidget, but I don't know MFC so maybe there's other similar way to do it.
    Hmm... OLE is ActiveX... so I don't know what exactly would you wrap into what...

    Just create a QAxWidget and use its setControl() method (inherited from QAxBase) to spawn an appropriate COM object to handle the resource you want to edit.

  3. #3
    Join Date
    Sep 2007
    Location
    Szczecin, Poland
    Posts
    153
    Thanks
    7
    Thanked 11 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Ole objects in Qt(MS OFFice)

    When I'm using QAxObject with "Excel.Application" control and calling dynamicCall("Activate()") it opens MS Excel as separate application with whole gui, separate window ect. and there's no control that is drawn as QAxWidget embedded in a window of my application. OLE objects is quite different mechanism that doesn't use COM objects directly but via ole32.dll windows library. The behaviour I want to achive is object that shows only a contents of a document in my application and makes it editable after a click(as when You i.e. click insert>object>"microSoft Excel WorkSheet" in MS Word).

    There's one workaround known to me: after activation of Excel.Application object, created window can be reparented to calling application, but it's still drawn with whole excel's gui stuff.
    Do you see the difference now?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Ole objects in Qt(MS OFFice)

    Actually, I don't think it looks exactly like that. The static image is just an image (you can't interact with it, i.e. select the contents with the mouse) - you can probably create one using QAxObject or a hidden QAxWidget. The actual "automation" takes place after you click the image to make it editable. Only then the actual component is embedded into the application.

    If you want to display a word document, you can probably spawn a word control, make it read only and strip it of all decorations.

    And by the way, wikipedia says you are wrong:
    Quote Originally Posted by wikipedia
    ActiveX is an alternate name for OLE automation (OLE - Object Linking and Embedding), not a separate technology.

  5. #5
    Join Date
    Sep 2007
    Location
    Szczecin, Poland
    Posts
    153
    Thanks
    7
    Thanked 11 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Ole objects in Qt(MS OFFice)

    I am using Office 2003 (maybe activeX controls are different in different versions of office) and QAxWidget doesn't draw anything(i got black screen).
    I'm doing everything as in Qt example and Outlook works embedded but Excel doesn't - they have different interfaces.

    OLE object indeed is an activeX but those aren't synonyms: OLE uses different interfaces & workflow - check it before quoting wrong informations. Ole objects behaves in a little different way than regular activeX controls and I need behaviour more like OLE(with embedding in application and ability to show contents only or edit a document, as i'm saying for the third time) and QAxWidget can't do it with office 2003 controls(QAxWidget doesn't draw excel embedded, but opens an application in separate window and full gui what's not what i'm want to!).

    I need some advise, not pointless conversation.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Ole objects in Qt(MS OFFice)

    Quote Originally Posted by mchara View Post
    I am using Office 2003 (maybe activeX controls are different in different versions of office) and QAxWidget doesn't draw anything(i got black screen).
    I'm doing everything as in Qt example and Outlook works embedded but Excel doesn't - they have different interfaces.
    Maybe the id is different? Either try passing the document you want to view as the control (like "C:\\somedoc.xls") or check what COM servers you have registered in your system. I don't think the application version should matter...

    OLE object indeed is an activeX but those aren't synonyms
    True. But ActiveX contains OLE functionality.

    I need some advise, not pointless conversation.
    If you need OLE functionality, you can fetch the correct interface using QAxBase API and perform a precise call using OLE interface. OLE is built over COM and you have full (most?) COM support in Qt, so this should be possible. So I advise you first focus on properly embedding the component in your application.

  7. #7
    Join Date
    Sep 2007
    Location
    Szczecin, Poland
    Posts
    153
    Thanks
    7
    Thanked 11 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Ole objects in Qt(MS OFFice)

    try passing the document you want to view as the control (like "C:\\somedoc.xls") .
    The QAxWidget with setControl to a file generates warnings and says that an object doesn't support automation and fails to activate it.
    Any ideas why it happens?

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Ole objects in Qt(MS OFFice)

    Quote Originally Posted by mchara View Post
    The QAxWidget with setControl to a file generates warnings and says that an object doesn't support automation and fails to activate it.
    Any ideas why it happens?
    Indeed weird, try passing "Excel.Application" then. And check out the "webbrowser" example - it uses the approach directly to embed a web browser and call its functions. You can use it as a test bed (even from within Designer), you just might need to remove the dynamicCall() line.

    Sorry I can't test it by myself but I don't have Excel and I'm currently working on Linux and don't want to stop to reboot the machine

  9. #9
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Ole objects in Qt(MS OFFice)

    I first tried
    dumpcpp Excel.Application -o excel
    which only gave me
    dumpcpp: type library '' not found
    Then I found this thread: http://lists.trolltech.com/qt-intere.../msg00704.html, so I tried:
    dumpcpp {00020813-0000-0000-C000-000000000046} -o excel
    which worked, but the resulting excel.h is 166k lines so I don't feel like diving into it as I'm not that familiar with the subject.
    J-P Nurmi

  10. #10
    Join Date
    Sep 2007
    Location
    Szczecin, Poland
    Posts
    153
    Thanks
    7
    Thanked 11 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Ole objects in Qt(MS OFFice)

    Yeah, already tried... but it generates automation object interface only.
    Just as QAxObject ...

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.