Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, February 2007
Controlling Excel from Qt


Message 1 in thread

Hi,

I'm starting to look at firing up Windows programmes from Qt using the active 
framework (QAxContainer etc.).  I am particularly interested in Excel at 
present.  

I've looked at the dumpcpp example based on Outlook and dumpcpp 
Outlook.Application works fine (produces .h, .cpp).  But when I tried the 
same with Excel.Application - I get "library not found." Same if I examine 
the registry and use the fancy long ID {000245-000 etc..)

It looks to me as though there is a fundamental difference between the way 
outlook is deployed (Object Library) and Excel (something else?).  I've seen 
evidence that others have managed to control Excel so it must be possible.  
Any pointers to relevant material to get me started would be much 
appreciated.

Regards,

Amit


--
 [ signature omitted ] 

Message 2 in thread

"amit" <pom2@xxxxxxxxxxxxxxxx> wrote in message 
news:200702170956.35511.pom2@xxxxxxxxxxxxxxxxxxx
> Hi,
>
> I'm starting to look at firing up Windows programmes from Qt using the 
> active
> framework (QAxContainer etc.).  I am particularly interested in Excel at
> present.
>
> I've looked at the dumpcpp example based on Outlook and dumpcpp
> Outlook.Application works fine (produces .h, .cpp).  But when I tried 
> the
> same with Excel.Application - I get "library not found." Same if I 
> examine
> the registry and use the fancy long ID {000245-000 etc..)
>
> It looks to me as though there is a fundamental difference between the 
> way
> outlook is deployed (Object Library) and Excel (something else?).  I've 
> seen
> evidence that others have managed to control Excel so it must be 
> possible.
> Any pointers to relevant material to get me started would be much
> appreciated.
>
> Regards,
>
> Amit


Adding the following to a .pro file works fine here:


EXCEL_TYPELIB = $$system(dumpcpp -getfile 
{00020813-0000-0000-C000-000000000046})
!isEmpty(EXCEL_TYPELIB): {
  TYPELIBS += $$EXCEL_TYPELIB
} else {
  message("Can't create C++ API for Excel, as Excel type library is not 
installed")
  DEFINES += NO_EXCEL_API
}


The ID specified is what is listed in my registry for the Excel type 
library.

But you can automate Excel even without a dumpcpp generated namespace. You 
just have to call every API via QAxObject::dynamicCall.


Volker


--
 [ signature omitted ] 

Message 3 in thread

On Monday 19 February 2007 08:48, Volker Hilsheimer wrote:

Volker,

many thanks for the extract and tips.  My call to dumpcpp failed when I use 
Excel.Application or Excel.Application.10 as the (assumed) name of the type 
library; are you using a different name?

A

>
> Adding the following to a .pro file works fine here:
>
>
> EXCEL_TYPELIB = $$system(dumpcpp -getfile
> {00020813-0000-0000-C000-000000000046})
> !isEmpty(EXCEL_TYPELIB): {
>   TYPELIBS += $$EXCEL_TYPELIB
> } else {
>   message("Can't create C++ API for Excel, as Excel type library is not
> installed")
>   DEFINES += NO_EXCEL_API
> }
>
>
> The ID specified is what is listed in my registry for the Excel type
> library.
>
> But you can automate Excel even without a dumpcpp generated namespace. You
> just have to call every API via QAxObject::dynamicCall.
>
>
> Volker
>
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body. List archive and information:
> http://lists.trolltech.com/qt-interest/

--
 [ signature omitted ]