anh5kor
11th December 2015, 13:44
I want to write the content to excel sheet.
I saw one thread in Qt about Read and Write Excel.
http://www.qtcentre.org/threads/8288-How-can-I-Read-Write-Excel-File
That described Excel reading via QAxObject.
But when I #include <QAxObject> in my Qt code.My compiler complain "No such file and directory.
So I am not able to write the code given below
QAxObject* excel = new QAxObject( "Excel.Application", 0 );
QAxObject* workbooks = excel->querySubObject( "Workbooks" );
QAxObject* workbook = workbooks->querySubObject( "Open(const QString&)", exchange->getFilename() );
QAxObject* sheets = workbook->querySubObject( "Worksheets" );
Please let me know how can I read and write an excel by using the above method or any other method.
Added after 47 minutes:
The above Query is solved.I have added the below two line.
"CONFIG += qaxcontainer" to pro file and added
#include <ActiveQt/QAxObject> as header and my code is working fine.
But I am getting problem in creating the Excel file.
The code on the above link shows how to open a excel file already created.
But I want that my code should create and save the excel to specific location.
Please let me know how can I achieve the same.
I saw one thread in Qt about Read and Write Excel.
http://www.qtcentre.org/threads/8288-How-can-I-Read-Write-Excel-File
That described Excel reading via QAxObject.
But when I #include <QAxObject> in my Qt code.My compiler complain "No such file and directory.
So I am not able to write the code given below
QAxObject* excel = new QAxObject( "Excel.Application", 0 );
QAxObject* workbooks = excel->querySubObject( "Workbooks" );
QAxObject* workbook = workbooks->querySubObject( "Open(const QString&)", exchange->getFilename() );
QAxObject* sheets = workbook->querySubObject( "Worksheets" );
Please let me know how can I read and write an excel by using the above method or any other method.
Added after 47 minutes:
The above Query is solved.I have added the below two line.
"CONFIG += qaxcontainer" to pro file and added
#include <ActiveQt/QAxObject> as header and my code is working fine.
But I am getting problem in creating the Excel file.
The code on the above link shows how to open a excel file already created.
But I want that my code should create and save the excel to specific location.
Please let me know how can I achieve the same.