Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt and Excell file
Forum Updated to NodeBB v4.3 + New Features

Qt and Excell file

Scheduled Pinned Locked Moved Solved General and Desktop
excel
6 Posts 3 Posters 1.0k Views 2 Watching
  • 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 Offline
    B Offline
    Babs
    wrote on 30 Jul 2020, 08:47 last edited by
    #1

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

    J 1 Reply Last reply 30 Jul 2020, 09:02
    0
    • B Babs
      30 Jul 2020, 08:47

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

      J Offline
      J Offline
      J.Hilk
      Moderators
      wrote on 30 Jul 2020, 09:02 last edited by
      #2

      @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


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

      B 1 Reply Last reply 30 Jul 2020, 10:54
      3
      • J J.Hilk
        30 Jul 2020, 09:02

        @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

        B Offline
        B Offline
        Babs
        wrote on 30 Jul 2020, 10:54 last edited by
        #3

        @J-Hilk thanks

        B 1 Reply Last reply 30 Jul 2020, 10:57
        0
        • B Babs
          30 Jul 2020, 10:54

          @J-Hilk thanks

          B Offline
          B Offline
          Babs
          wrote on 30 Jul 2020, 10:57 last edited by
          #4

          @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
          
          
          M 1 Reply Last reply 30 Jul 2020, 11:06
          0
          • B Babs
            30 Jul 2020, 10:57

            @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
            
            
            M Offline
            M Offline
            mrjj
            Lifetime Qt Champion
            wrote on 30 Jul 2020, 11:06 last edited by mrjj
            #5

            @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 30 Jul 2020, 11:44
            4
            • M mrjj
              30 Jul 2020, 11:06

              @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 Offline
              B Offline
              Babs
              wrote on 30 Jul 2020, 11:44 last edited by
              #6

              @mrjj thanks

              1 Reply Last reply
              0

              6/6

              30 Jul 2020, 11:44

              • Login

              • Login or register to search.
              6 out of 6
              • First post
                6/6
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved