Search code examples
c++excelqtqt5activeqt

Open and communicate with Excel in my Qt Application


I'm actually creating an application in QtCreator (open source), and I need to open Excel and communicate by sending to Excel data to show. I try to #include <QAxWidget> , and to modify my .pro file with:

CONFIG+= axcontainer
Qt += activeqt

But it didn't work. I've got the error QAxWidget was not declared in this scope. I read lots of things contradictory on the Internet, like you must paid licence or else.

Can you explain to me, if there's a way to solve my problem? Thanks.


Solution

  • You need the "Qt5-way" of using the module from your project file:

    QT += axcontainer
    

    Also, you need to include the necessary header of course:

    #include <QAxWidget>
    

    You can find the more thorough explanation here with examples.