[Qt-interest] reading data from xls file
Malyushytsky, Alex
alex at wai.com
Fri Aug 7 22:54:48 CEST 2009
As I understand it, QAxObject is wrapper for COM.
This means you can access any methods of the COM object you are dealing with provides. (It is Excel in your case)
This also means, that you must not only have xls file to read, but Excel installed on the computer your application is running on.
This limitation may be or may be not acceptable for you.
If it is not, the only way left is to read Excel file yourself.
If it is your intention to start Excel and read the file in it, you should understand that the
only thing QAxObject does- it allows you to create COM object and call it methods or set properties.
You have to figure out what object and methods you need.
This has nothing to do with Qt.
You might want to search web how it is done in visual basic, C# or C++ and use similar methods in your QT code.
For example the following link seems gives information how it can be done:
http://vbadud.blogspot.com/2008/06/search-and-open-files-using-excel-vba.html
(It looks like you need to get Workbook object and use Open method )
Microsoft probably published interfaces too, so try to search msdn.com, if the link above is not enough.
Here is another link I think might be useful to read for you, cause correctly asked question is 75% of the answer:
http://www.catb.org/~esr/faqs/smart-questions.html#id306810
Regards,
Alex
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Yuvaraj R
Sent: Thursday, August 06, 2009 9:44 PM
To: Yao Huiji
Cc: qt-interest
Subject: Re: [Qt-interest] reading data from xls file
can u say me , where i have give the xls file path ?
Thanks
Yuvaraj R
On Fri, Aug 7, 2009 at 10:10 AM, Yao Huiji <spideryao at gmail.com> wrote:
I guess QAxObjec will get the info from window registry
2009/8/7 Yuvaraj R <yuvaraj at ongobiz.com>
Hi All
Just i have gone through the sample code..
QAxObject* excel = new QAxObject("Excel.Application", 0);
QAxObject* app = excel->querySubObject("Application()");
QAxObject* wbks = excel->querySubObject("Workbooks()");
QAxObject* wb = wbks->querySubObject("Add()");
QAxObject* ws = wb->querySubObject("Worksheets(int)", 1 );
I am not understanding the above code.. Where they are getting input file here..
If u don't mistake me , can u expain me in breif..
Thanks
Yuvaraj R
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest
---------------------------------------------------------------------------------------------------
Weidlinger Associates, Inc. made the following annotations.
"This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you."
"Please consider our environment before printing this email."
More information about the Qt-interest-old
mailing list