Qt and Excell file
Solved
General and Desktop
-
@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 -
@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
-
@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.