Trying to export to Excel
I have found some code that I am playing with to learn how to export data to Excel
Code:
QAxObject* app
= excel
->querySubObject
("Application()");
QAxObject* wbks
= excel
->querySubObject
("Workbooks()");
QAxObject* wb
= wbks
->querySubObject
("Add()");
QAxObject* ws
= wb
->querySubObject
("Worksheets(int)",
1 );
//Show Excel
app->setProperty("Visible", true );
However, I get the following errors:
Quote:
release/mainwindow.o:mainwindow.cpp::: error: undefined reference to `QAxObject::QAxObject(QString const&, QObject*)'
release/mainwindow.o:mainwindow.cpp::: error: undefined reference to `QAxBase::querySubObject(char const*, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&)'
release/mainwindow.o:mainwindow.cpp::: error: undefined reference to `QAxBase::querySubObject(char const*, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&)'
release/mainwindow.o:mainwindow.cpp::: error: undefined reference to `QAxBase::querySubObject(char const*, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&)'
release/mainwindow.o:mainwindow.cpp::: error: undefined reference to `QAxBase::querySubObject(char const*, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&)'
I have #include <QAxObject> at the beginning of the code.
Can someone tell me where I am going wrong?
Thanks.
Re: Trying to export to Excel
Hi, you are missing the necessary libraries during linking (QAxServer.lib and/or QAxContainer.lib). Add them to the linker command line and it should work.
Ginsengelf
Re: Trying to export to Excel
read about ActiveQt module in Assistant. Do you have your ActiveQt module already compiled?
Re: Trying to export to Excel
I've got no idea about the ActiveQt module being compiled or not!!!?
I installed the latest SDK, and then installed the latest Qt Creator, both .exe's. I didn't specifically compile anything.
How do I check, and if needed, go about compiling this?
I have added the following to my .pro file, but stil same error...
Code:
LIBS += -QAxServer.lib \
-QAxContainer.lib
Re: Trying to export to Excel
Thank you. I corrected it. It is now
Code:
LIBS += -lqaxserver \
-lqaxcontainer
and it works!
Re: Trying to export to Excel
Actually just needed
Code:
1.LIBS += -lqaxserver
Re: Trying to export to Excel
My apologies, it is actually the other library , i.e. qaxcontainer, not qaxserver that is needed.
Not sure why it actually compiled using the qaxserver only, but this morning it doesn't anymore, and swopping them now lets it work again.
Re: Trying to export to Excel
i added this and its work.
CONFIG += qaxcontainer