Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Solved Qt and Excell file

    General and Desktop
    excel
    3
    6
    489
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      Babs last edited by

      Hello,
      Is there any Qt feature allowing to work efficiently with Excel format files ( read, write , extraction...) ?

      J.Hilk 1 Reply Last reply Reply Quote 0
      • J.Hilk
        J.Hilk Moderators @Babs last edited by

        @Babs you can use QSql (to a certain degree) or Qt's ActiveX framework

        the wiki has an example:
        https://wiki.qt.io/Handling_Microsoft_Excel_file_format

        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct

        Qt Needs YOUR vote: https://bugreports.qt.io/browse/QTQAINFRA-4121


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        B 1 Reply Last reply Reply Quote 3
        • B
          Babs @J.Hilk last edited by

          @J-Hilk thanks

          B 1 Reply Last reply Reply Quote 0
          • B
            Babs @Babs last edited by

            @Babs I've got the following when i use the Qt's ActiveX framework

                QCoreApplication app(argc,argv);
                QAxObject* excel = new QAxObject( "Excel.Application");
                qDebug()<<"jere";
                QAxObject* workbooks = excel->querySubObject( "Workbooks" );
                /*QAxObject* workbook = workbooks->querySubObject( "Open(const QString&)", "C:\\Program Files (x86)\\MILESYS\\SacemSol\\secteur_11\\resultat\\20200728_161431RERA_S11.xlsx" );
                QAxObject* sheets = workbook->querySubObject( "Worksheets" );
                QList<QVariantList> data; //Data list from excel, each QVariantList is worksheet row
            
                //worksheets count
                int count = sheets->dynamicCall("Count()").toInt();
                qDebug()<<count;*/
            
            
            
            
                return app.exec();
            

            I've got this error after launching:

            QAxBase::setControl: requested control Excel.Application could not be instantiated
            jere
            QAxBase::dynamicCallHelper: Object is not initialized, or initialization failed
            
            
            mrjj 1 Reply Last reply Reply Quote 0
            • mrjj
              mrjj Lifetime Qt Champion @Babs last edited by mrjj

              @Babs
              Hi
              You do have Excel installed, right ?

              There is also
              https://github.com/dbzhang800/QtXlsxWriter
              http://qtxlsx.debao.me/

              Also see here
              https://forum.qt.io/topic/89536/qaxobject-and-excel/3
              use QApplication a(argc, argv); instead of QCoreApplication app(argc,argv);

              Ahh should work.

              B 1 Reply Last reply Reply Quote 4
              • B
                Babs @mrjj last edited by

                @mrjj thanks

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post